Boost logo

Boost :

Subject: Re: [boost] [type_traits] has_equal_to< std::vector<T> > always true_
From: lcaminiti (lorcaminiti_at_[hidden])
Date: 2012-04-25 09:02:40


Frédéric Bron wrote
>
>> Were these traits specialized for the STL in any of the latest Boost
>> releases?
>
> don't think so.
>

Do I have permission to add the specializations for STL containers to trunk
and then the to release 1.50?

1) I'd add something like this for each STL container that defines an
operator==:

    template< typename T, class Alloc = std::allocator<T> >
    struct has_equal_to< std::vector<T, Alloc> > : has_equal_to<T> {};

2) I'd add similar specializations for all traits that apply !=, <=, etc.

3) I'd add the specializations in the trait header
type_traits/has_equal_to.hpp, etc and not into special headers
type_traits/std/vector.hpp, .etc (because when I use has_equal_to on
std::vector I'd always expect it to work according to the specialized
version as a user and achieving expected behavior should require no extra
user step like including type_traits/std/vector.hpp).

I'm happy to change the code, check the regression tests, and I don't think
any documentation needs to be changed (because the specializations just make
the traits work as the user expects them to work).

What do you think?

Thanks.
--Lorenzo

--
View this message in context: http://boost.2283326.n4.nabble.com/boost-type-traits-has-equal-to-std-vector-T-always-true-tp3922160p4586512.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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