]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | /*============================================================================= |
2 | Copyright (c) 2001-2014 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_X3_UNUSED_APRIL_16_2006_0616PM) | |
9 | #define BOOST_SPIRIT_X3_UNUSED_APRIL_16_2006_0616PM | |
10 | ||
11 | #include <ostream> | |
12 | #include <istream> | |
13 | #include <boost/mpl/identity.hpp> | |
14 | ||
15 | #if defined(BOOST_MSVC) | |
16 | # pragma warning(push) | |
17 | # pragma warning(disable: 4522) // multiple assignment operators specified warning | |
18 | #endif | |
19 | ||
20 | /////////////////////////////////////////////////////////////////////////////// | |
21 | namespace boost { namespace spirit { namespace x3 | |
22 | { | |
23 | struct unused_type | |
24 | { | |
25 | unused_type() | |
26 | { | |
27 | } | |
28 | ||
29 | template <typename T> | |
30 | unused_type(T const&) | |
31 | { | |
32 | } | |
33 | ||
34 | template <typename T> | |
35 | unused_type const& | |
36 | operator=(T const&) const | |
37 | { | |
38 | return *this; | |
39 | } | |
40 | ||
41 | template <typename T> | |
42 | unused_type& | |
43 | operator=(T const&) | |
44 | { | |
45 | return *this; | |
46 | } | |
47 | ||
48 | unused_type const& | |
49 | operator=(unused_type const&) const | |
50 | { | |
51 | return *this; | |
52 | } | |
53 | ||
54 | unused_type& | |
55 | operator=(unused_type const&) | |
56 | { | |
57 | return *this; | |
58 | } | |
59 | ||
60 | // unused_type can also masquerade as an empty context (see context.hpp) | |
61 | ||
62 | template <typename ID> | |
63 | unused_type get(ID) const | |
64 | { | |
65 | return {}; | |
66 | } | |
67 | }; | |
68 | ||
69 | auto const unused = unused_type{}; | |
70 | ||
71 | inline std::ostream& operator<<(std::ostream& out, unused_type const&) | |
72 | { | |
73 | return out; | |
74 | } | |
75 | ||
76 | inline std::istream& operator>>(std::istream& in, unused_type&) | |
77 | { | |
78 | return in; | |
79 | } | |
80 | }}} | |
81 | ||
82 | #if defined(BOOST_MSVC) | |
83 | # pragma warning(pop) | |
84 | #endif | |
85 | ||
86 | #endif |