[#BloombergLP-bdlb-TransformIterator] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::TransformIterator :relfileprefix: ../../ :mrdocs: The transform iterator class itself. Its job is to hold a functor and an iterator, pass through all iterator‐related operations to the held iterator, and on dereference, call the functor on the result of dereferencing the iterator and return the result of the call instead. == Synopsis Declared in `<bdlb_transformiterator.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class FUNCTOR, class ITERATOR> class TransformIterator : public xref:BloombergLP/bdlb/TransformIterator_AllocatorOfIteratorMethod-00.adoc[TransformIterator_AllocatorOfIteratorMethod<TransformIterator<FUNCTOR, ITERATOR>, bslma::UsesBslmaAllocator<ITERATOR>::value>] , public xref:BloombergLP/bdlb/TransformIterator_AllocatorOfFunctorMethod-01.adoc[TransformIterator_AllocatorOfFunctorMethod<TransformIterator<FUNCTOR, ITERATOR>, !bslma::UsesBslmaAllocator<ITERATOR>::value && bslma::UsesBslmaAllocator<FUNCTOR>::value>] ---- == Base Classes [cols="1,4"] |=== | Name| Description | `xref:BloombergLP/bdlb/TransformIterator_AllocatorOfIteratorMethod-00.adoc[TransformIterator_AllocatorOfIteratorMethod<TransformIterator<FUNCTOR, ITERATOR>, bslma::UsesBslmaAllocator<ITERATOR>::value>]` | The `TransformIterator_AllocatorOfIteratorMethod` class template has an allocator method when its boolean template parameter is `true`, which will be made to be the case when the iterator of the transform iterator uses allocators. The transform iterator type itself is supplied as `BASE_TYPE`. | `xref:BloombergLP/bdlb/TransformIterator_AllocatorOfFunctorMethod-01.adoc[TransformIterator_AllocatorOfFunctorMethod<TransformIterator<FUNCTOR, ITERATOR>, !bslma::UsesBslmaAllocator<ITERATOR>::value && bslma::UsesBslmaAllocator<FUNCTOR>::value>]` | The `TransformIterator_AllocatorOfFunctorMethod` class template has an allocator method when its boolean template parameter is `true`, which will be made to be the case when the iterator of the transform iterator does not use allocators and the functor of the transform iterator uses allocators. The transform iterator type itself is supplied as `BASE_TYPE`. |=== == Type Aliases [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/TransformIterator/difference_type.adoc[`difference_type`] | Type used to represent distances between iterators. | xref:BloombergLP/bdlb/TransformIterator/iterator_category.adoc[`iterator_category`] | Iterator category of this transform iterator. | xref:BloombergLP/bdlb/TransformIterator/pointer.adoc[`pointer`] | Pointer type for this iterator. | xref:BloombergLP/bdlb/TransformIterator/reference.adoc[`reference`] | Reference type returned by dereferencing this iterator. | xref:BloombergLP/bdlb/TransformIterator/value_type.adoc[`value_type`] | Value type produced by dereferencing this iterator. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/TransformIterator/2constructor-026.adoc[`TransformIterator`] [.small]#[constructor]# | Constructors | xref:BloombergLP/bdlb/TransformIterator/operator_assign.adoc[`operator=`] | Assign to this object the value of the specified `rhs` object, and return a reference providing modifiable access to this object. | xref:BloombergLP/bdlb/TransformIterator/functor-0c.adoc[`functor`] | `functor` overloads | xref:BloombergLP/bdlb/TransformIterator/iterator-00.adoc[`iterator`] | `iterator` overloads | xref:BloombergLP/bdlb/TransformIterator/operator_star-04.adoc[`operator*`] | Return the result of applying the functor of this object to the result of dereferencing the underlying iterator. The behavior is undefined if dereferencing the underlying iterator is undefined. Note that the behavior of this method is equivalent to: ` functor()(*iterator()) ` | xref:BloombergLP/bdlb/TransformIterator/operator_inc.adoc[`operator++`] | Increment the underlying iterator of this object, and return a reference providing modifiable access to this object. The behavior is undefined if incrementing the underlying iterator is undefined. | xref:BloombergLP/bdlb/TransformIterator/operator_plus_eq.adoc[`operator+=`] | Advance the underlying iterator of this object by the specified (signed) `offset`, and return a reference providing modifiable access to this object. The behavior is undefined if so advancing the underlying iterator is undefined. | xref:BloombergLP/bdlb/TransformIterator/operator_dec.adoc[`operator‐‐`] | Decrement the underlying iterator of this object, and return a reference providing modifiable access to this object. The behavior is undefined if decrementing the underlying iterator is undefined. | xref:BloombergLP/bdlb/TransformIterator/operator_minus_eq.adoc[`operator‐=`] | Regress the underlying iterator of this object by the specified (signed) `offset`, and return a reference providing modifiable access to this object. The behavior is undefined if so regressing the underlying iterator is undefined. | xref:BloombergLP/bdlb/TransformIterator/operator_ptr-09.adoc[`operator‐>`] | Return the address of the result of applying the functor of this object to the result of dereferencing the underlying iterator. The behavior is undefined if dereferencing the underlying iterator is undefined. Note that the behavior of this method is equivalent to: ` &functor()(*iterator()) ` Also note that the functor must return a reference type for this method to be used. | xref:BloombergLP/bdlb/TransformIterator/operator_subs-04.adoc[`operator[]`] | Return the result of applying the functor of this object to the result of dereferencing the underlying iterator advanced by the specified (signed) `offset`. The behavior is undefined if so advancing or dereferencing the underlying iterator is undefined. Note that the behavior of this method is equivalent to: ` functor()(iterator()[offset]) ` | xref:BloombergLP/bdlb/TransformIterator/swap.adoc[`swap`] | Efficiently exchange the value of this object with the value of the specified `other` object by applying `swap` to each of the functor and underlying iterator fields of the two objects. | xref:BloombergLP/bdlb/TransformIterator/2conversion.adoc[`operator BloombergLP::bslmf::NestedTraitDeclaration<TransformIterator, UsesBslmaAllocator, bslma::UsesBslmaAllocator<ITERATOR>::value || bslma::UsesBslmaAllocator<FUNCTOR>::value>`] | Nested trait declaration for `bslma::UsesBslmaAllocator`. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bdlb/operator_not_eq-01f.adoc[`operator!=`] | Return `true` if the underlying iterator of the specified `lhs` compares unequal to the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/operator_plus-03.adoc[`operator+`] | Return a copy of the specified `iterator` object with its underlying iterator advanced by the specified (signed) `offset` from that of `iterator`. The behavior is undefined if so advancing the underlying iterator is undefined. | xref:BloombergLP/bdlb/operator_plus-0f.adoc[`operator+`] | Return a copy of the specified `iterator` object with its underlying iterator advanced by the specified (signed) `offset` from that of `iterator`. The behavior is undefined if so advancing the underlying iterator is undefined. | xref:BloombergLP/bdlb/operator_inc-0e.adoc[`operator++`] | Increment the underlying iterator of the specified `iterator`, and return a copy of `iterator` _before_ the increment. The behavior is undefined if incrementing the underlying iterator is undefined. | xref:BloombergLP/bdlb/operator_minus-04.adoc[`operator‐`] | Return the result of subtracting the underlying iterator of the specified `a` object from the underlying iterator of the specified `b` object. The behavior is undefined if this subtraction is undefined. | xref:BloombergLP/bdlb/operator_minus-09.adoc[`operator‐`] | Return a copy of the specified `iterator` object with its underlying iterator regressed by the specified (signed) `offset` from that of `iterator`. The behavior is undefined if so regressing the underlying iterator is undefined. | xref:BloombergLP/bdlb/operator_dec.adoc[`operator‐‐`] | Decrement the underlying iterator of the specified `iterator`, and return a copy of `iterator` _before_ the decrement. The behavior is undefined if decrementing the underlying iterator is undefined. | xref:BloombergLP/bdlb/operator_lt-042.adoc[`operator<`] | Return `true` if the underlying iterator of the specified `lhs` compares less than the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/operator_le-0f9.adoc[`operator<=`] | Return `true` if the underlying iterator of the specified `lhs` compares less than or equal to the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/operator_eq-0f63.adoc[`operator==`] | Return `true` if the underlying iterator of the specified `lhs` compares equal to the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/operator_gt-011b.adoc[`operator>`] | Return `true` if the underlying iterator of the specified `lhs` compares greater than the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/operator_ge-0cf5.adoc[`operator>=`] | Return `true` if the underlying iterator of the specified `lhs` compares greater than or equal to the underlying iterator of the specified `rhs`, and `false` otherwise. The behavior is undefined if comparing the underlying iterators in this way is undefined. Note that the functors are not compared. | xref:BloombergLP/bdlb/swap-0d.adoc[`swap`] | Efficiently exchange the values of the specified `a` and `b` objects by applying `swap` to each of the functor and underlying iterator fields of the two objects. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#