
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