#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace te = boost::type_erasure; namespace mpl = boost::mpl; BOOST_TYPE_ERASURE_MEMBER((has_insert), insert, 1) BOOST_TYPE_ERASURE_MEMBER((has_count), count, 1) BOOST_TYPE_ERASURE_MEMBER((has_find), find, 1) template struct get_value_type_impl { typedef typename T::value_type type; }; template struct get_value_type { typedef typename mpl::eval_if, mpl::identity, get_value_type_impl >::type type; }; typedef te::deduced > _value; struct requirements : boost::mpl::vector< te::copy_constructible<>, //we can copy sets te::relaxed, //various other common features te::typeid_<>, //they can be dynamic cast has_count //count copies of key in the set // has_insert,bool>(const _value&)>, //insert a key > {}; typedef te::any any_set; typedef te::any erased_value; int main(int argc, const char *argv[]) { std::unordered_set h; any_set history(h); BOOST_STATIC_ASSERT((boost::is_same >::type, int>::value)); history.count(1); }