Boost logo

Boost :

From: John Maddock (john_at_[hidden])
Date: 2005-01-02 11:01:08


>> Any thoughts from the type_traits authors?
>
> I think decayed is an excellent trait. Your implementation should be
> modified to also take care of functions converting into function pointers
> though. It's a shame about the const qaulifier in your example make_pair
> messing up the int[10] conversion to int*.

I agree that it should work for function to function-pointer conversions as
well.

I've attached a slightly improved version that gets your non-const make_pair
working, also uses remove_bounds rather than the range lib traits (just to
keep things in the type_traits family).

Not sure about the "decayed" name, but I can't think of anything better
right now.

> This is a characteristic of pair, not make_pair. And it could be disabled
> by restricting the member template constructor in:
>
> template <class T1, class T2>
> struct pair {
> typedef T1 first_type;
> typedef T2 second_type;
>
> T1 first;
> T2 second;
> pair();
> pair(const T1& x, const T2& y);
> template<class U, class V> pair(const pair<U, V> &p);
> };
>
> such that is_convertible<U, T1> and is_convertible<V, T2>, which is a
> change I would support.

If we do that, then we should do the same for the tuple constructors as
well.

John.


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