/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_TYPE_TRAITS_IS_KEY_CONTAINER_OF_HPP_JOFA_100829 #define BOOST_ICL_TYPE_TRAITS_IS_KEY_CONTAINER_OF_HPP_JOFA_100829 #include #include #include namespace boost{ namespace icl { //-------------------------------------------------------------------------- namespace detail { BOOST_MPL_HAS_XXX_TRAIT_DEF(key_object_type) } //-------------------------------------------------------------------------- template struct has_key_object_type : mpl::bool_::value> {}; template struct get_key_object_type; template struct get_key_object_type { typedef Type no_type; }; template struct get_key_object_type { typedef Type type; }; template struct get_key_object_type { typedef typename Type::key_object_type type; }; template struct key_container_type_of { typedef typename get_key_object_type < Type , has_key_object_type::value , mpl::or_, is_map >::value >::type type; }; //-------------------------------------------------------------------------- template struct is_strict_key_container_of // set is_strict_key_container_of map { typedef is_strict_key_container_of type; BOOST_STATIC_CONSTANT(bool, value = (mpl::and_< is_map , boost::is_same::type> >::value) ); }; template struct is_key_container_of // set is_key_container_of (set or map) { typedef is_key_container_of type; BOOST_STATIC_CONSTANT(bool, value = (mpl::or_< is_strict_key_container_of , mpl::and_< mpl::or_, is_map > , boost::is_same > >::value) ); }; }} // namespace boost icl #endif