This class implements an iterator that returns the result of applying a binary function object to the return value of two other iterators. More...
#include <array.hpp>
Public Types | |
typedef left_base_iterator_type_ | left_base_iterator_type |
typedef right_base_iterator_type_ | right_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<typename other_left_base_iterator_type_ , typename other_right_base_iterator_type_ > | |
LITE_INLINE | b_iterator (const other_left_base_iterator_type_ &lbase_iter, const other_right_base_iterator_type_ &rbase_iter) |
Creates a b_iterator from the base iterators lbase_iter and rbase_iter. | |
LITE_INLINE | b_iterator (const b_iterator &other) |
template<typename other_left_base_iterator_type_ , typename other_right_base_iterator_type_ > | |
LITE_INLINE | b_iterator (const b_iterator< other_left_base_iterator_type_, other_right_base_iterator_type_, func_type_, is_static_ > &other) |
Creates a b_iterator with the base iterators lbase_iter and rbase_iter and the function object func. | |
template<typename other_left_base_iterator_type_ , typename other_right_base_iterator_type_ > | |
LITE_INLINE | b_iterator (const other_left_base_iterator_type_ &lbase_iter, const other_right_base_iterator_type_ &rbase_iter, const function_type &func) |
LITE_INLINE b_iterator & | operator= (const b_iterator &other) |
template<typename other_left_base_iterator_type_ , typename other_right_base_iterator_type_ > | |
LITE_INLINE b_iterator & | operator= (const b_iterator< other_left_base_iterator_type_, other_right_base_iterator_type_, func_type_, is_static_ > &other) |
Public Attributes | |
left_base_iterator_type | left_base_iterator |
This variable stores the left base iterator. | |
right_base_iterator_type | right_base_iterator |
This variable stores the right 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_ |
This class implements an iterator that returns the result of applying a binary function object to the return value of two other iterators.
The type left_base_iter_type_ and right_base_iter_type_ specify the type of the underlying iterators. The type func_type_ specifies the type of the binary function object that is applied to the return value of the the two bsae iterators. If is_static_ is true then the function object will be a static member of the b_iterator object and thus won't occupy any memory in the b_iterator object. If is_static_ is false then the function object will be a regular member of the b_iterator object and thus will occupy memory in the b_iterator object.
All the required operations (i.e. at()
, inc()
, dec()
, shift()
) are also defined.
typedef array<float[2][2]> A; A a1, a2; typedef b_iterator<A::iterator, A::iterator, lite::plus, true> Iter; typedef array<float[2][2], default_array_traits, reference_rep<Iter> > B; B b(Iter(a1.begin(), a2.begin()), a1.size()); std::cin >> a1 >> a2; std::cout << b << std::endl;
Assuming that the input is:
1 2 3 4 1 10 10 1
The output would be:
2 12 13 5
LITE_INLINE lite::b_iterator< left_base_iterator_type_, right_base_iterator_type_, func_type_, is_static_ >::b_iterator | ( | const b_iterator< other_left_base_iterator_type_, other_right_base_iterator_type_, func_type_, is_static_ > & | other | ) | [inline] |
Creates a b_iterator with the base iterators lbase_iter and rbase_iter and the function object func.