Boost logo

Boost :

Subject: Re: [boost] [conversion] ADL and templates
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-06-01 07:56:01


Stewart, Robert wrote:
>
> Vicente Botet wrote:
>
>
> Having just one CP is better. Sure, PTS is less obvious than overloading
> a function template, but having to know about both mechanisms and which is
> necessary in various circumstances, makes the whole mechanism more
> complicated than it should be.
>

Glad to see that we agree here.

>> I suspect that after refactoring, I will rename the namespace
>> overload_workaround by something more positive. Any
>> suggestions?
>
> namespace boost
> {
> namespace conversion
> {
> template <class Target, class Source, class Enable = void>
> struct converter
> {
> Target
> operator (Source const &) const;
> };
> }
> }
>
> Note that I'm suggesting
> boost::conversion::converter<Target,Source,Enable> as the name and
> I'm suggesting s/apply/operator ()/ to make it a function object. These
> alterations mean that there is now a function object interface for
> effecting conversions from Source to Target which is the sole point of
> customization for all such conversions in the library.
>

Yes, this could be a valid possibility. I will need to fix names for the
other function objects associated to assign_to (assigner?), try_convert_to
(try_converter), ... Or shouldn't the library provide CP for all the
operations?

> BTW, it might be wise to make the primary specialization fail, perhaps
> through the use of BCCL in the convert_to function template.
>

Yes, this could be done adding a dependency on BCCL. If others think this is
a must I would try to include it conditionally.

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/conversion-ADL-and-templates-tp3561641p3565635.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk