[Patch] Second half of tr1/complex

Howard Hinnant hhinnant@apple.com
Fri Jan 13 16:31:00 GMT 2006


On Jan 13, 2006, at 11:20 AM, Paolo Carlini wrote:

> Howard Hinnant wrote:
>
>> ADL  can effectively open and look into namespaces in a fairly subtle
>> manner.
>
> Ok, if ADL is really at issue, I agree, anything can happen with the
> present ADL rules and one can never be sufficiently defensive. In that
> case, I agree, we have to think about adding __enable_ifs everywhere.
>
> Then, however, from a much broader point of view, isn't this just a  
> sign
> that what we *really* want are concepts?
>
> I mean, being TR1 sort of an experimental testbed of *some* C++0x
> features, I'm thinking that adding ugly __enable_if tricks everywhere,
> which certainly will not be present in a C++0x library, isn't really
> appropriate. In other terms, in TR1 are being experimented, e.g., new
> complex facilities, *not* restricted templates or new ADL rules. In  
> yet
> other terms, if, as you said, the C++03 standard is chock full of
> "dangerous" unrestricted templates (algorithms!), why for the C++03 +
> TR1 experiment we want at any cost something better while still  
> missing
> the necessary language feature (concepts)?
>
> Paolo.

That's cool by me.  Restricting these templates is just a suggestion,  
nothing I'm going to loose sleep over. :-)

Fwiw, in C++03, I've seen the most casualties from:

template <class InputIterator>
typename iterator_traits<InputIterator>::difference_type
distance(InputIterator first, InputIterator last);

and close behind (in second place):

template <class InputIterator, class Distance>
void
advance(InputIterator& i, Distance n);

They look a lot worse if you don't give the template parameters nice  
descriptive names.

-Howard



More information about the Libstdc++ mailing list