lite::u_iterator< base_iter_type_, func_type_, is_static_ > Class Template Reference
[Array Internals (Advanced)]

This class implements an iterator that returns the result of applying a function object to the return value of another iterator. More...

#include <array.hpp>

List of all members.

Public Types

typedef base_iter_type_ base_iterator_type
typedef func_type_ function_type
typedef
std::random_access_iterator_tag 
iterator_category
typedef detail::remove
< typename
func_type_::result_type, const
volatile int & >::type 
value_type
typedef ptrdiff_t difference_type
typedef func_type_::result_type reference
typedef detail::remove
< typename
func_type_::result_type, int & >
::type * 
pointer

Public Member Functions

template<class other_base_iter_type_ >
LITE_INLINE u_iterator (const other_base_iter_type_ &base_iter)
 Creates a u_iterator with the base iterator base_iter.
template<class other_base_iter_type_ >
LITE_INLINE u_iterator (const other_base_iter_type_ &base_iter, const function_type &func)
 Creates a u_iterator with the base iterator base_iter and the function object func.
LITE_INLINE u_iterator (const u_iterator &other)
template<class other_base_iter_type_ >
LITE_INLINE u_iterator (const u_iterator< other_base_iter_type_, func_type_, is_static_ > &other)
LITE_INLINE u_iteratoroperator= (const u_iterator &other)
template<typename other_base_iter_type_ >
LITE_INLINE u_iteratoroperator= (const u_iterator< other_base_iter_type_, func_type_, is_static_ > &other)

Public Attributes

base_iterator_type base_iterator
 This variable stores the base iterator.
function_type function
 This variable stores the function object. It will be a static member if is_static_ is true.

Static Public Attributes

static const bool is_static = is_static_

Detailed Description

template<typename base_iter_type_, typename func_type_, bool is_static_ = true>
class lite::u_iterator< base_iter_type_, func_type_, is_static_ >

This class implements an iterator that returns the result of applying a function object to the return value of another iterator.

The type base_iter_type_ specifies the type of the underlying iterator. The type func_type_ specifies the type of the function object that is applied to the return value of the base iterator. If is_static_ is true then the function object will be a static member of the u_iterator object and thus won't occupy any memory in the u_iterator object. If is_static_ is false then the function object will be a regular member of the u_iterator object and thus will occupy memory in the u_iterator object.

All the required operations (i.e. at(), inc(), dec(), shift()) are also defined.

Example:
        typedef array<float[2][2]> A;

        A a;
        
        typedef u_iterator<A::iterator, lite::square, true> Iter; 
        typedef array<float[2][2], default_array_traits, reference_rep<Iter> > B;

        B b(Iter(a.begin()), a.size());

        std::cin >> a; 
        std::cout << b << std::endl;

Assuming that the input is:

        1 2
        3 4
    

The output would be:

        1 4
        9 16
    

Constructor & Destructor Documentation

template<typename base_iter_type_, typename func_type_, bool is_static_ = true>
template<class other_base_iter_type_ >
LITE_INLINE lite::u_iterator< base_iter_type_, func_type_, is_static_ >::u_iterator ( const other_base_iter_type_ &  base_iter,
const function_type &  func 
) [inline]

Creates a u_iterator with the base iterator base_iter and the function object func.

Remarks:
This constructor is defined only if is_static_ is false.

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Defines

Generated on Fri Nov 6 02:03:21 2009 for Lite by  doxygen 1.6.0