|
Boost : |
From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-08-26 09:17:01
In my current project, there are a lot of code fragments that read like
this:
result->insert( "positions",
positions_.begin(),
positions_.end(),
bind( &Position::serialize,
_1,
boost::cref( locale ) ) );
The scheme is always the same, all that varies is the name of the
serialized class. Thus I wanted to write a helper:
result->insert( "positions",
positions_.begin(),
positions_.end(),
serializer< Position >( locale ) );
But the problem is, that AFAIK I have no (documented) way to specify the
result type of such a helper function. The syntax I would imagine
basically looks like this:
template< typename T >
typename Bind< &T::serialize, _1_type,
boost::reference_wrapper< const Base::Locale > >::result_type
serializer( const Base::Locale& locale ) {
return bind( &T::serialize, _1, boost::cref( locale ) );
}
Is something like that possible? I hope so, but I guess I'm not the
expert to understand all the details involved in the bind-internals. The
above is just an idea, of course it might look different in practice.
The question is, whether we can create some mapping between the call of
the bind-function and a provider for the result type that users can
understand without looking into the code of bind itself.
Regards, Daniel
-- Daniel Frey aixigo AG - financial training, research and technology Schloß-Rahe-Straße 15, 52072 Aachen, Germany fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99 eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk