#include <RCObject.h>
Public Methods | |
template<typename RCOBJPTR> RCOBJPTR | operator() (RCOBJPTR pRCObject) |
Function call operator for one argument, being the pointer to an object. More... | |
template<typename AnyType, typename RCOBJPTR> const std::pair< AnyType, RCOBJPTR > & | operator() (std::pair< AnyType, RCOBJPTR > &p) |
Function call operator for a pair of arguments. More... |
With this helper functor it's easy and efficient to add a reference to each object contained in a STL container. To copy a container of reference counted objects and increase their reference count you could do something like that:
for ( iter=src.begin() ; iter!=src.end() ; ++iter ) { dst.push_back( *iter ); (*iter)->addRef(); }
transform( src.begin(), src.end(), inserter( dst, dst.begin()), addReference() );
|
Function call operator for one argument, being the pointer to an object. The member function addRef() of an RCObject is called on the argument.
|
|
Function call operator for a pair of arguments. The member function addRef() of an RCObject is called on the second element of the pair of arguments.
|