Boost logo

Boost :

Subject: [boost] [conversion] Release v0.4: Replace function template specialization by ADL
From: vicente.botet (vicente.botet_at_[hidden])
Date: 2009-10-27 11:22:07


I have just released the version 0.4 of Boost.Conversion , which includes since my last publicly announced version 0.3:

Replace function template specialization by ADL

A Source class is convertible to a Target class if:
* Either: A function with the signature convert_to<Target>(Source const&, boost::dummy::type_tag<To> const&) is available via argument dependent lookup
* Or: A template specialization of boost::conversion::convert_to<Target, Source> exists for Target and Source
* Or: Target is copy constructible from Source (default implementation)

The template function convert_to allows to convert a source type to a target type, using argument dependent lookup to select a specialized convert_to function if available. If no specialized convert_to function is available, boost::conversion::convert_to is used.

The generic convert_to function requires that the elements to be converted are assignable and copy constructible. It is implemented using the Target copy construction from a Source or the Source conversion operator Target - this is sometimes unavailable.

For standard types, we can not add a specialized convert_to function on the namespace std. The alternative to using argument dependent lookup in this situation is to provide a template specialization of boost::conversion::convert_to for every pair of standard types that requires a specialized convert_to.

You can found all the detail for dowloading, documentation, ... in

I'd appreciate it if people could take a look, test it on their compiler and give me some feedback.

Thanks to Edward Diener for showing me that multiple assignments should be taken in account. Thanks also to Jeffrey Hellrung and Robert Stewart for showing me that Boost.Conversion should use also ADL.

BTW, I'm looking for a review manager. Anyone around here who would like to volunteer?

Best regards,
Vicente Juan Botet Escribá

Boost list run by bdawes at, gregod at, cpdaniel at, john at