]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/spirit/include/boost/spirit/home/support/unused.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / spirit / include / boost / spirit / home / support / unused.hpp
CommitLineData
7c673cae
FG
1/*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3 Copyright (c) 2001-2011 Hartmut Kaiser
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_UNUSED_APRIL_16_2006_0616PM)
9#define BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM
10
11#if defined(_MSC_VER)
12#pragma once
13#endif
14
15#include <boost/config.hpp>
16#include <boost/mpl/bool.hpp>
17
18#if defined(BOOST_MSVC)
19# pragma warning(push)
20# pragma warning(disable: 4522) // multiple assignment operators specified warning
21#endif
22
23///////////////////////////////////////////////////////////////////////////////
24namespace boost { namespace spirit
25{
26 ///////////////////////////////////////////////////////////////////////////
27 // We do not import fusion ::unused_type anymore to avoid boost::fusion
28 // being turned into an associate namespace for boost::spirit, as this
29 // interferes with ADL in unexpected ways. We rather copy the full
30 // unused_type implementation from boost::fusion.
31 ///////////////////////////////////////////////////////////////////////////
32 struct unused_type
33 {
34 unused_type()
35 {
36 }
37
38 template <typename T>
39 unused_type(T const&)
40 {
41 }
42
43 template <typename T>
44 unused_type const&
45 operator=(T const&) const
46 {
47 return *this;
48 }
49
50 template <typename T>
51 unused_type&
52 operator=(T const&)
53 {
54 return *this;
55 }
56
57 unused_type const&
58 operator=(unused_type const&) const
59 {
60 return *this;
61 }
62
63 unused_type&
64 operator=(unused_type const&)
65 {
66 return *this;
67 }
68 };
69
70 unused_type const unused = unused_type();
71
72 namespace detail
73 {
74 struct unused_only
75 {
76 unused_only(unused_type const&) {}
77 };
78 }
79
80 template <typename Out>
81 inline Out& operator<<(Out& out, detail::unused_only const&)
82 {
83 return out;
84 }
85
86 template <typename In>
87 inline In& operator>>(In& in, unused_type&)
88 {
89 return in;
90 }
91
92 ///////////////////////////////////////////////////////////////////////////
93 namespace traits
94 {
95 // We use this test to detect if the argument is not an unused_type
96 template <typename T> struct not_is_unused : mpl::true_ {};
97 template <> struct not_is_unused<unused_type> : mpl::false_ {};
98 }
99}}
100
101#if defined(BOOST_MSVC)
102# pragma warning(pop)
103#endif
104
105#endif