|
Boost : |
Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-27 13:54:39
On Fri, Feb 27, 2009 at 5:40 AM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
> On Thursday, February 26, 2009 5:09 PM
> Emil Dotchevski wrote:
>> On Thu, Feb 26, 2009 at 12:42 PM, Andrey Semashev
>> <andrey.semashev_at_[hidden]> wrote:
>> >
>> > template< typename ArgsT >
>> > std::string operator()( ArgsT const& args ) const
>> > {
>> > return operator() (args[source], args[arg1], args[arg2]);
>> > }
>>
>> I understand the problem very well, and I think the solution is not to
>> write a function that takes a single args argument, but instead to
>> provide overloads. This would not only solve your problem, it would
>> also make convert() compatible with boost::bind/function/lambda etc.
>>
>> What's wrong with the following call syntax:
>>
>> boost::convert<target>( source const & [,arg1,arg2,...] )
>>
>> that is, the caller provides the target type for the conversion, then
>> the first argument is considered the source (deduced automatically),
>> and the rest of the arguments configure the conversion.
>
> That only works if the argument types and number are known ahead of time. The Boost.Parameter approach allows for open ended extension -- for good or ill.
I don't understand. The overload-based approach can also be extended
-- by providing more overloads, user-defined or generic overloads
given by the convert framework itself.
Emil Dotchevski
Reverge Studios, Inc.
http://www.revergestudios.com/reblog/index.php?n=ReCode
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk