Boost logo

Boost :

Subject: Re: [boost] Formal Review Request: Boost.Convert
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2009-02-28 13:00:17


On Sat, Feb 28, 2009 at 8:48 AM, Steven Watanabe <watanabesj_at_[hidden]> wrote:
> AMDG
>
> Emil Dotchevski wrote:
>>
>> 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.
>>
>> Going back to my uuid example, uuid.hpp could simply say:
>>
>> #include <string>
>>
>> namespace user {
>>  class uuid;
>>  template <class Target> Target convert( uuid const & );
>>  template <> std::string convert<std::string>( uuid const & );
>> }
>>
>
> This overload of convert cannot reliably be found as the
> syntax convert<std::string>(...) doesn't invoke ADL.
> (At least, not according to the standard.  Some compilers
> perform ADL in this case anyway)

True, so how about to_string, instead of convert :))

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