/*============================================================================= Copyright (c) 2001-2014 Joel de Guzman Copyright (c) 2001-2011 Hartmut Kaiser http://spirit.sourceforge.net/ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ #if !defined(BOOST_SPIRIT_X3_OPTIONAL_TRAITS_FEBRUARY_06_2007_1001AM) #define BOOST_SPIRIT_X3_OPTIONAL_TRAITS_FEBRUARY_06_2007_1001AM #include #include #include namespace boost { namespace spirit { namespace x3 { namespace traits { /////////////////////////////////////////////////////////////////////////// template struct is_optional : mpl::false_ {}; template struct is_optional> : mpl::true_ {}; /////////////////////////////////////////////////////////////////////////// // build_optional // // Build a boost::optional from T. Return unused_type if T is unused_type. /////////////////////////////////////////////////////////////////////////// template struct build_optional { typedef boost::optional type; }; template struct build_optional > { typedef boost::optional type; }; template <> struct build_optional { typedef unused_type type; }; /////////////////////////////////////////////////////////////////////////// // optional_value // // Get the optional's value_type. Handles unused_type as well. /////////////////////////////////////////////////////////////////////////// template struct optional_value : mpl::identity {}; template struct optional_value > : mpl::identity {}; template <> struct optional_value : mpl::identity {}; template <> struct optional_value : mpl::identity {}; }}}} #endif