]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/range/include/boost/range/detail/extract_optional_type.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / range / include / boost / range / detail / extract_optional_type.hpp
1 // Boost.Range library
2 //
3 // Copyright Arno Schoedl & Neil Groves 2009.
4 // Use, modification and distribution is subject to the Boost Software
5 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7 //
8 // For more information, see http://www.boost.org/libs/range/
9 //
10 #ifndef BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED
11 #define BOOST_RANGE_DETAIL_EXTRACT_OPTIONAL_TYPE_HPP_INCLUDED
12
13 #if defined(_MSC_VER)
14 # pragma once
15 #endif
16
17 #include <boost/config.hpp>
18 #include <boost/preprocessor/cat.hpp>
19 #include <boost/mpl/has_xxx.hpp>
20
21 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX)
22
23 // Defines extract_some_typedef<T> which exposes T::some_typedef as
24 // extract_some_typedef<T>::type if T::some_typedef exists. Otherwise
25 // extract_some_typedef<T> is empty.
26 #define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \
27 BOOST_MPL_HAS_XXX_TRAIT_DEF(a_typedef) \
28 template< typename C, bool B = BOOST_PP_CAT(has_, a_typedef)<C>::value > \
29 struct BOOST_PP_CAT(extract_, a_typedef) \
30 {}; \
31 template< typename C > \
32 struct BOOST_PP_CAT(extract_, a_typedef)< C, true > \
33 { \
34 typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \
35 };
36
37 #else
38
39 #define BOOST_RANGE_EXTRACT_OPTIONAL_TYPE( a_typedef ) \
40 template< typename C > \
41 struct BOOST_PP_CAT(extract_, a_typedef) \
42 { \
43 typedef BOOST_DEDUCED_TYPENAME C::a_typedef type; \
44 };
45
46 #endif
47
48 #endif // include guard