46 template<
class T>
const T *
get()
const ;
86 template<
class T>
bool remove(
const T * );
95 typedef void (*DeleteFunction)(
void *);
97 typedef std::pair< const std::type_info * , DeleteFunction > Manager ;
99 const void * p_get(
const std::type_info & )
const ;
101 const void * p_insert(
const Manager & ,
const void * );
103 bool p_remove(
const std::type_info & ,
const void * );
105 std::vector< Manager > m_manager ;
106 std::vector< const void * > m_value ;
117 #ifndef DOXYGEN_COMPILE
125 void cset_member_delete(
void * v ) {
delete reinterpret_cast<T*
>( v ); }
131 {
return (
const T*) p_get(
typeid(T) ); }
138 m.first = &
typeid(T);
139 m.second = & cset_member_delete<T> ;
140 return (
const T *) p_insert( m , arg_value );
148 m.first = &
typeid(T);
150 return (
const T *) p_insert( m , arg_value );
156 {
return p_remove(
typeid(T) , arg_value ); }
const T * insert_no_delete(const T *)
Insert a member of a given type T but never invoke the delete operator.
const T * get() const
Get member conforming to the given type T . Return NULL if there is no member of that type...
const T * insert_with_delete(const T *)
Insert a member of a given type T and invoke the delete operator on destruction.
bool remove(const T *)
Remove a member of the given type without deleting it. The caller assumes responsibility for the remo...
Set of entities of arbitrary types.