public: /** Returns true, if the object associated to the passed key exists.
Returns false, if the key exists but points to an empty reference. */ bool has(const key_type& rKey) const
{ const mapped_type* pxRef = getRef(rKey); return pxRef && pxRef->get();
}
/** Returns a reference to the object associated to the passed key, or an
empty reference on error. */
mapped_type get(const key_type& rKey) const
{ if( const mapped_type* pxRef = getRef(rKey) ) return *pxRef; return mapped_type();
}
/** Calls the passed functor for every contained object, automatically
skips all elements that are empty references. */ template< typename FunctorType > void forEach( const FunctorType& rFunctor ) const
{
std::for_each( this->begin(), this->end(), ForEachFunctor< FunctorType >( rFunctor ) );
}
/** Calls the passed member function of ObjType on every contained object,
automatically skips all elements that are empty references. */ template< typename FuncType > void forEachMem( FuncType pFunc ) const
{
forEach( ::std::bind( pFunc, std::placeholders::_1 ) );
}
/** Calls the passed member function of ObjType on every contained object,
automatically skips all elements that are empty references. */ template< typename FuncType, typename ParamType1, typename ParamType2 > void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2 ) const
{
forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2 ) );
}
/** Calls the passed member function of ObjType on every contained object,
automatically skips all elements that are empty references. */ template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3 > void forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3 ) const
{
forEach( ::std::bind( pFunc, std::placeholders::_1, aParam1, aParam2, aParam3 ) );
}
/** Calls the passed functor for every contained object. Passes the key as
first argument and the object reference as second argument to rFunctor. */ template< typename FunctorType > void forEachWithKey( const FunctorType& rFunctor ) const
{
std::for_each( this->begin(), this->end(), ForEachFunctorWithKey< FunctorType >( rFunctor ) );
}
/** Calls the passed member function of ObjType on every contained object.
Passes the object key as argument to the member function. */ template< typename FuncType > void forEachMemWithKey( FuncType pFunc ) const
{
forEachWithKey( ::std::bind( pFunc, std::placeholders::_2, std::placeholders::_1 ) );
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.