Boost logo

Boost :

Subject: Re: [boost] [conversion] review
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2011-09-01 15:49:05


On Wed, Aug 31, 2011 at 11:10 PM, Vicente J. Botet Escriba
<vicente.botet_at_[hidden]> wrote:
> Le 01/09/11 03:15, Emil Dotchevski a écrit :
>> If templates were required, the call to
>> explicit_convert_to could instantiate a template instead of resorting
>> to implicit conversion. I'm not saying that one is better than the
>> other, only that both should be supported.
>>
> Here I'm lost.

#include <iostream>

int foo( int ) { return 1; }
template <class T> int foo( T ) { return 2; }

int main()
{
  std::cout << foo(42L);
}

The presence of the template inhibits the implicit conversion of long
to int. Sometimes this is desirable and sometimes it is not, and if
the syntax used to call foo requires it to be a template, potentially
useful implicit conversions can't kick in. I do understand that there
is no such requirement in Conversion.

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