]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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_SEGMENT_TYPE_OF_HPP_JOFA_100902 | |
9 | #define BOOST_ICL_TYPE_TRAITS_SEGMENT_TYPE_OF_HPP_JOFA_100902 | |
10 | ||
11 | #include <boost/mpl/has_xxx.hpp> | |
12 | #include <boost/mpl/bool.hpp> | |
13 | #include <boost/icl/type_traits/no_type.hpp> | |
14 | ||
15 | namespace boost{ namespace icl | |
16 | { | |
17 | namespace detail | |
18 | { | |
19 | BOOST_MPL_HAS_XXX_TRAIT_DEF(segment_type) | |
20 | } | |
21 | ||
22 | template <class Type> | |
23 | struct has_segment_type | |
24 | : mpl::bool_<detail::has_segment_type<Type>::value> | |
25 | {}; | |
26 | ||
27 | template <class Type, bool has_segment_type> | |
28 | struct get_segment_type; | |
29 | ||
30 | template <class Type> | |
31 | struct get_segment_type<Type, false> | |
32 | { | |
33 | typedef no_type type; | |
34 | }; | |
35 | ||
36 | template <class Type> | |
37 | struct get_segment_type<Type, true> | |
38 | { | |
39 | typedef typename Type::segment_type type; | |
40 | }; | |
41 | ||
42 | template <class Type> | |
43 | struct segment_type_of | |
44 | { | |
45 | typedef typename | |
46 | get_segment_type<Type, has_segment_type<Type>::value>::type type; | |
47 | }; | |
48 | ||
49 | }} // namespace boost icl | |
50 | ||
51 | #endif | |
52 | ||
53 |