Listing 2: The assigner class
template< typename C, typename V = typename C::value_type >
class assigner
{
public:
typedef V value_type;
explicit assigner( C& c ) : c_( c ) {}
explicit assigner( C& c, const value_type& v ) : c_( c )
{
insert( c_, v );
}
assigner& operator,( const value_type& v )
{
insert( c_, v );
return *this;
}
template< typename T, typename T2 >
assigner& operator()( const T& t, const T2& t2 )
{
insert( c_, value_type( t, t2 ) );
return *this;
}
private:
assigner& operator=( const assigner& );
C& c_;
};
End of Listing