]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/include/boost/spirit/home/x3/support/traits/variant_has_substitute.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / x3 / support / traits / variant_has_substitute.hpp
CommitLineData
7c673cae
FG
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_VARIANT_HAS_SUBSTITUTE_APR_18_2014_925AM)
9#define BOOST_SPIRIT_X3_VARIANT_HAS_SUBSTITUTE_APR_18_2014_925AM
10
11#include <boost/spirit/home/x3/support/traits/is_substitute.hpp>
12
13namespace boost { namespace spirit { namespace x3 { namespace traits
14{
15 template <typename Variant, typename Attribute>
16 struct variant_has_substitute_impl
17 {
18 // Find a type from the variant that can be a substitute for Attribute.
19 // return true_ if one is found, else false_
20
21 typedef Variant variant_type;
22 typedef typename variant_type::types types;
23 typedef typename mpl::end<types>::type end;
24
25 typedef typename
26 mpl::find_if<types, is_same<mpl::_1, Attribute>>::type
27 iter_1;
28
29 typedef typename
30 mpl::eval_if<
31 is_same<iter_1, end>,
32 mpl::find_if<types, traits::is_substitute<mpl::_1, Attribute>>,
33 mpl::identity<iter_1>
34 >::type
35 iter;
36
37 typedef mpl::not_<is_same<iter, end>> type;
38 };
39
40 template <typename Variant, typename Attribute>
41 struct variant_has_substitute
42 : variant_has_substitute_impl<Variant, Attribute>::type {};
43
44 template <typename Attribute>
45 struct variant_has_substitute<unused_type, Attribute> : mpl::true_ {};
46
47 template <typename Attribute>
48 struct variant_has_substitute<unused_type const, Attribute> : mpl::true_ {};
49
50}}}}
51
52#endif