
Christian Holmquist wrote:
Hello,
I've had much use of a small traits class for identifying types that matches the STL Container concept (roughly) . Two functions is made available, is_container<T> and container_category_of<T>.
is_container simply evaluates to true_type or false_type, container_category_of tries to categorize T with the following tags.
struct non_container_tag {}; struct container_tag {}; struct sequence_container_tag : public container_tag {}; struct associative_container_tag : public container_tag {}; struct hashed_container_tag : public associative_container_tag {};
template<class T, class Tag = container_tag> struct is_container
It must be useful. It could be more useful if it supports 'is_std_pair' and 'is_std_vector' etc. Also, <std_pair_fwd.hpp> and <std_vector_fwd.hpp> etc could be useful. -- Shunsuke Sogame