1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2008-2009: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENCE.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef BOOST_ICL_TYPE_TRAITS_SIZE_TYPE_OF_HPP_JOFA_080911
9 #define BOOST_ICL_TYPE_TRAITS_SIZE_TYPE_OF_HPP_JOFA_080911
11 #include <boost/mpl/has_xxx.hpp>
12 #include <boost/icl/type_traits/difference_type_of.hpp>
14 namespace boost{ namespace icl
19 BOOST_MPL_HAS_XXX_TRAIT_DEF(size_type)
22 //--------------------------------------------------------------------------
25 : mpl::bool_<detail::has_size_type<Type>::value>
28 //--------------------------------------------------------------------------
29 template <class Type, bool has_size, bool has_diff, bool has_rep>
33 struct get_size_type<Type, false, false, false>
35 typedef std::size_t type;
38 template <class Type, bool has_diff, bool has_rep>
39 struct get_size_type<Type, true, has_diff, has_rep>
41 typedef typename Type::size_type type;
44 template <class Type, bool has_rep>
45 struct get_size_type<Type, false, true, has_rep>
47 typedef typename Type::difference_type type;
51 struct get_size_type<Type, false, false, true>
56 //--------------------------------------------------------------------------
62 , has_size_type<Type>::value
63 , has_difference_type<Type>::value
64 , has_rep_type<Type>::value
68 }} // namespace boost icl