• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*=============================================================================
2     Copyright (c) 2001-2014 Joel de Guzman
3     http://spirit.sourceforge.net/
4 
5     Distributed under the Boost Software License, Version 1.0. (See accompanying
6     file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 =============================================================================*/
8 #if !defined(BOOST_SPIRIT_X3_IS_VARIANT_JAN_10_2012_0823AM)
9 #define BOOST_SPIRIT_X3_IS_VARIANT_JAN_10_2012_0823AM
10 
11 #include <boost/variant.hpp>
12 #include <boost/mpl/has_xxx.hpp>
13 #include <boost/mpl/bool.hpp>
14 
15 namespace boost { namespace spirit { namespace x3 { namespace traits
16 {
17     namespace detail
18     {
19         // By declaring a nested struct in your class/struct, you tell
20         // spirit that it is regarded as a variant type. The minimum
21         // required interface for such a variant is that it has constructors
22         // for various types supported by your variant and a typedef 'types'
23         // which is an mpl sequence of the contained types.
24         //
25         // This is an intrusive interface. For a non-intrusive interface,
26         // use the is_variant trait.
27         BOOST_MPL_HAS_XXX_TRAIT_DEF(adapted_variant_tag)
28     }
29 
30     template <typename T, typename Enable = void>
31     struct is_variant
32       : detail::has_adapted_variant_tag<T>
33     {};
34 
35     template <BOOST_VARIANT_ENUM_PARAMS(typename T)>
36     struct is_variant<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>>
37       : mpl::true_
38     {};
39 }}}}
40 
41 #endif
42