File indexing completed on 2025-01-31 10:02:38
0001
0002
0003
0004
0005
0006
0007
0008
0009 #if !defined(BOOST_SPIRIT_X3_OPTIONAL_TRAITS_FEBRUARY_06_2007_1001AM)
0010 #define BOOST_SPIRIT_X3_OPTIONAL_TRAITS_FEBRUARY_06_2007_1001AM
0011
0012 #include <boost/spirit/home/x3/support/unused.hpp>
0013 #include <boost/optional/optional.hpp>
0014 #include <boost/mpl/identity.hpp>
0015
0016 namespace boost { namespace spirit { namespace x3 { namespace traits
0017 {
0018
0019 template <typename T, typename Enable = void>
0020 struct is_optional
0021 : mpl::false_
0022 {};
0023
0024 template <typename T>
0025 struct is_optional<boost::optional<T>>
0026 : mpl::true_
0027 {};
0028
0029
0030
0031
0032
0033
0034 template <typename T>
0035 struct build_optional
0036 {
0037 typedef boost::optional<T> type;
0038 };
0039
0040 template <typename T>
0041 struct build_optional<boost::optional<T> >
0042 {
0043 typedef boost::optional<T> type;
0044 };
0045
0046 template <>
0047 struct build_optional<unused_type>
0048 {
0049 typedef unused_type type;
0050 };
0051
0052
0053
0054
0055
0056
0057 template <typename T>
0058 struct optional_value : mpl::identity<T> {};
0059
0060 template <typename T>
0061 struct optional_value<boost::optional<T> >
0062 : mpl::identity<T> {};
0063
0064 template <>
0065 struct optional_value<unused_type>
0066 : mpl::identity<unused_type> {};
0067
0068 template <>
0069 struct optional_value<unused_type const>
0070 : mpl::identity<unused_type> {};
0071
0072 }}}}
0073
0074 #endif