$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [Conversion] Practical applications
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2011-08-23 14:07:38
Le 23/08/11 19:05, Phil Endecott a écrit :
> Hi Vicente,
>
> Vicente J. Botet Escriba wrote:
>> Le 22/08/11 22:50, Phil Endecott a ?crit :
>>> Vicente J. Botet Escriba wrote:
>>>> If we can construct implicitly a pair from another pair of
>>>> implicitly convertible types, why we couldn't allow the conversion
>>>> from a pair of type that are extrinsically implicitly convertible
>>>> to them?
>
>>> Right. But does your library make this possible?
>
>> The specialization of the customization point implicit_convert_cp
>> allows to convert 'implicitly' pairs of extrinsicaly convertible
>> types using the implicit_convert_to function. Now the user ca use the
>> explicit_convert_to function to convert these types as for example
>>
>> B1 b1;
>> B2 b2;
>> std::pair<B1,B2> b;
>> std::pair<A1,A2>
>> a1(boost::conversion::explicit_convert_to<std::pair<A1,A2> >(b));
>>
>> Note that implicit convertible implies explicit convertible.
>>
>> I wrote implicitly with coutes because we need to use a function
>> which makes the call explicit.
>
>> Resuming, the user wanting extrinsically implicit conversions, must
>> use explicitly the 'implicitly' function.
>
> I was really hoping that I had misunderstood something and that
> actually your library could make it possible to have extrinsic
> implicit conversions. But it doesn't; the conversions still require
> additional syntax. So they aren't implicit conversions.
>
Strinctly speaking not. But implicitly(s) is extrinsicaly implicitly
convertible. It is something similar as how ref(x) is not a reference to
x, but can be used to transport a reference, which is enough useful.
> Since you can't add this additional syntax to e.g. the std::
> algorithms, I am still struggling to see how the library is useful.
>
We can add them whereever we consider is useful to Boost.Containers (of
course the last word is to Ion). Note that we can define also conversion
between containers extrinsically.
Best,
Vicente