It is not uncommon to use boost::function to hold on to the result of boost::bind. Will that work for you?

- Mat

--On Tuesday, August 26, 2003 4:17 PM +0200 Daniel Frey <[EMAIL PROTECTED]> wrote:

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: [EMAIL PROTECTED], web: http://www.aixigo.de


_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to