yat  0.18pre
Public Member Functions | List of all members
theplu::yat::utility::Dereferencer< Pointer > Struct Template Reference

Adaptor between pointer and pointee interface. More...

#include <yat/utility/stl_utility.h>

Inheritance diagram for theplu::yat::utility::Dereferencer< Pointer >:

Public Member Functions

 Dereferencer (void)
 constructor
 
std::iterator_traits< Pointer >::reference operator() (Pointer ti) const
 

Detailed Description

template<typename Pointer>
struct theplu::yat::utility::Dereferencer< Pointer >

Adaptor between pointer and pointee interface.

Functor takes a pointer and returns a reference to the instance pointer is pointing to. Return type is decided by std::iterator_traits<Pointer>::reference . Pointer must have an operator*, i.e., Pointer can be a traditional pointer or an Input Iterator.

The class is designed to be used with boost::transform_iterator

std::vector<MyClass*> vec;
...
Dereferencer<MyClass*> dereferencer;
std::set<MyClass> s;
s.insert(boost::make_transform_iterator(vec.begin(), dereferencer),
boost::make_transform_iterator(vec.end(), dereferencer))

where elements in vec<MyClass*> are copied in to set<MyClass>.

Since
New in yat 0.7

Member Function Documentation

template<typename Pointer >
std::iterator_traits<Pointer>::reference theplu::yat::utility::Dereferencer< Pointer >::operator() ( Pointer  ti) const
inline
Returns
* ti

The documentation for this struct was generated from the following file:

Generated on Sun Sep 27 2020 02:26:14 for yat by  doxygen 1.8.11