class MapFiller
{
std::map<K,V> & MapRef;
-
+
public:
MapFiller( std::map<K,V> & map_ref)
: MapRef(map_ref)
{
}
-
+
MapFiller& operator () (const K& key, const V& value)
{
MapRef[key]= value;
return *this;
}
-
+
}; // eo class MapFiller
/**
* convenience class to fill values into a container (using push_back).
*/
-template<typename T, template <typename> class C= std::list >
+template<
+ typename T,
+ template< typename, typename> class C= std::list,
+ typename Alloc = std::allocator< T >
+>
class PushBackFiller
{
- C<T> &CRef;
+ C< T, Alloc > &CRef;
public:
- PushBackFiller( C<T> & c )
+ PushBackFiller( C<T, Alloc > & c )
: CRef(c)
{}
-
+
PushBackFiller& operator () (const T& value)
{
CRef.push_back(value);
return *this;
} // eo operator ()
-
+
}; // eo class PushBackFiller
-template< typename T, template <typename> class C >
-PushBackFiller< T, C > get_push_back_filler( C< T >& c)
+template<
+ typename T,
+ template< typename, typename > class C,
+ typename Alloc
+>
+PushBackFiller< T, C, Alloc > get_push_back_filler( C< T, Alloc >& c)
{
- return PushBackFiller< T, C >(c);
-} // eo get_push_back_filler(C< T >&)
+ return PushBackFiller< T, C, Alloc >(c);
+} // eo get_push_back_filler(C< T, Alloc >&)
/**
* convenience class for transient construction of a container including values.
*/
-template<typename T, template<typename> class C= std::list >
+template<
+ typename T,
+ template< typename, typename> class C= std::list,
+ typename Alloc = std::allocator< T >
+>
class TransientPushBackFiller
{
- C< T > MyC;
+ C< T, Alloc > MyC;
public:
- typedef C< T > CType;
+ typedef C< T, Alloc > CType;
TransientPushBackFiller()
{}