]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/icl/type_traits/codomain_type_of.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / icl / type_traits / codomain_type_of.hpp
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_CODOMAIN_TYPE_OF_HPP_JOFA_100829
9 #define BOOST_ICL_TYPE_TRAITS_CODOMAIN_TYPE_OF_HPP_JOFA_100829
10
11 #include <set>
12 #include <boost/mpl/has_xxx.hpp>
13 #include <boost/mpl/bool.hpp>
14 #include <boost/icl/type_traits/no_type.hpp>
15 #include <boost/icl/type_traits/is_container.hpp>
16
17 namespace boost{ namespace icl
18 {
19 namespace detail
20 {
21 BOOST_MPL_HAS_XXX_TRAIT_DEF(codomain_type)
22 }
23
24 template <class Type>
25 struct has_codomain_type
26 : mpl::bool_<detail::has_codomain_type<Type>::value>
27 {};
28
29 template <class Type, bool has_codomain_type, bool is_std_set>
30 struct get_codomain_type;
31
32 template <class Type>
33 struct get_codomain_type<Type, false, false>
34 {
35 typedef no_type type;
36 };
37
38 template <class Type, bool is_std_set>
39 struct get_codomain_type<Type, true, is_std_set>
40 {
41 typedef typename Type::codomain_type type;
42 };
43
44 template <class Type>
45 struct get_codomain_type<Type, false, true>
46 {
47 typedef typename Type::value_type type;
48 };
49
50 template <class Type>
51 struct codomain_type_of
52 {
53 typedef typename
54 get_codomain_type< Type
55 , has_codomain_type<Type>::value
56 , is_std_set<Type>::value
57 >::type type;
58 };
59
60 }} // namespace boost icl
61
62 #endif
63
64