Re: [boost] [type_traits] has_equal_to< std::vector<T> > always true_

We could use <boost/detail/container_fwd.hpp> here (rather like Boost.Hash does, which has a similar issue) and get the best of both worlds? My concern about making it a separate header, is that it runs the risk of ADL errors if the #includes are inconsistent across translation units. I assume that only forward declarations are needed for the containers?
This looks a very good idea. It is a pity that the standard does not provide such header as it does for iostreams (iosfwd). However, I see that <boost/detail/container_fwd.hpp> has some troubles with many compilers, in particular with g++. // GNU libstdc++ 3 // Disable forwarding for all recent versions, as the library has a // versioned namespace mode, and I don't know how to detect it. This is a major drawback but maybe we can do something for it. I see also that with the new standard, this header is now not exhaustive; we have to include all of these: * <array> - <deque> * <forward_list> - <list> - <vector> - <map> - <set> * <unordered_map> * <unordered_set> - <queue> - <stack> - <string> - <bitset> *: missing headers in <boost/detail/container_fwd.hpp> Frédéric

On 30 April 2012 05:48, Frédéric Bron <frederic.bron@m4x.org> wrote:
This looks a very good idea. It is a pity that the standard does not provide such header as it does for iostreams (iosfwd). However, I see that <boost/detail/container_fwd.hpp> has some troubles with many compilers, in particular with g++. // GNU libstdc++ 3 // Disable forwarding for all recent versions, as the library has a // versioned namespace mode, and I don't know how to detect it. This is a major drawback but maybe we can do something for it.
That's pretty new, I received a bug report a little while ago and couldn't find much information about it. If anyone knows a better solution, let me know. With libstdc++ forward declaration almost always works, but it's hard to detect the cases where it won't. But for some other standard libraries (esp. libc++) it never does.
I see also that with the new standard, this header is now not exhaustive; we have to include all of these: * <array> - <deque> * <forward_list> - <list> - <vector> - <map> - <set> * <unordered_map> * <unordered_set> - <queue> - <stack> - <string> - <bitset>
*: missing headers in <boost/detail/container_fwd.hpp>
I'd rather not add extra headers, since they often get included rather than forward declared. Maybe could have another C++11 header, or more fine grained headers. I think if I was starting fresh, I probably wouldn't put everything into a single header, and require the user to include extra headers for standard library objects (e.g. #include <boost/functional/hash/hash_std_vector.hpp>).
participants (2)
-
Daniel James
-
Frédéric Bron