MRPT logo

mrpt::utils::metaprogramming Namespace Reference

A set of utility objects for metaprogramming with STL algorithms. More...


Classes

struct  ObjectDelete
 An object for deleting pointers (intended for STL algorithms). More...
struct  ObjectClear
 An object for clearing an object (invokes its method "->clear()") given a pointer or smart-pointer, intended for being used in STL algorithms. More...
struct  ObjectClear2
 An object for clearing an object (invokes its method ".clear()") given a pointer or smart-pointer, intended for being used in STL algorithms. More...
struct  ObjectClearSecond
 An object for clearing an object->second (invokes its method "clear()") given a pointer or smart-pointer, intended for being used in STL algorithms. More...
struct  ObjectConvert
 An object for transforming between types/classes, intended for being used in STL algorithms. More...
struct  ObjectMakeUnique
 An object for making smart pointers unique (ie, making copies if necessary), intended for being used in STL algorithms. More...
struct  ObjectPairMakeUnique
 An object for making smart pointers unique (ie, making copies if necessary), intended for being used in STL algorithms. More...
struct  ObjectClearUnique
 An object for making smart pointers unique (ie, making copies if necessary), intended for being used in STL algorithms. More...
struct  ObjectReadFromStream
 An object for reading objects from a stream, intended for being used in STL algorithms. More...
struct  ObjectWriteToStream
 An object for writing objects to a stream, intended for being used in STL algorithms. More...

Functions

template<typename it_src , typename it_dst >
void copy_typecasting (it_src first, it_src last, it_dst target)
 Behaves like std::copy but allows the source and target iterators to be of different types through static typecasting.
template<typename src_container , typename dst_container >
void copy_container_typecasting (const src_container &src, dst_container &trg)
 Copy all the elements in a container (vector, deque, list) into a different one performing the appropriate typecasting.


Detailed Description

A set of utility objects for metaprogramming with STL algorithms.


Function Documentation

template<typename src_container , typename dst_container >
void mrpt::utils::metaprogramming::copy_container_typecasting ( const src_container &  src,
dst_container &  trg 
) [inline]

Copy all the elements in a container (vector, deque, list) into a different one performing the appropriate typecasting.

The target container is automatically resized to the appropriate size, and previous contents are lost. This can be used to assign std::vector's of different types:

   std::vector<int>    vi(10);
   std::vector<float>  vf;
   vf = vi;   // Compiler error
   mrpt::utils::metaprogramming::copy_container_typecasting(v1,vf);  // Ok

Definition at line 167 of file metaprogramming.h.

References copy_typecasting().

Referenced by mrpt::opengl::CAngularObservationMesh::FTrace2D< T >::operator()().

template<typename it_src , typename it_dst >
void mrpt::utils::metaprogramming::copy_typecasting ( it_src  first,
it_src  last,
it_dst  target 
) [inline]

Behaves like std::copy but allows the source and target iterators to be of different types through static typecasting.

Note:
As in std::copy, the target iterator must point to the first "slot" where to put the first transformed element, and sufficient space must be allocated in advance.
See also:
copy_container_typecasting

Definition at line 150 of file metaprogramming.h.

Referenced by copy_container_typecasting().




Page generated by Doxygen 1.5.9 for MRPT 0.7.1 SVN: at Mon Aug 17 22:20:53 EDT 2009