comparison DEPENDENCIES/generic/include/boost/spirit/home/x3/support/unused.hpp @ 102:f46d142149f5

Whoops, finish that update
author Chris Cannam
date Mon, 07 Sep 2015 11:13:41 +0100
parents
children
comparison
equal deleted inserted replaced
101:c530137014c0 102:f46d142149f5
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 #if defined(_MSC_VER)
12 #pragma once
13 #endif
14
15 #include <ostream>
16 #include <istream>
17 #include <boost/mpl/identity.hpp>
18
19 #if defined(BOOST_MSVC)
20 # pragma warning(push)
21 # pragma warning(disable: 4522) // multiple assignment operators specified warning
22 #endif
23
24 ///////////////////////////////////////////////////////////////////////////////
25 namespace boost { namespace spirit { namespace x3
26 {
27 struct unused_type
28 {
29 unused_type()
30 {
31 }
32
33 template <typename T>
34 unused_type(T const&)
35 {
36 }
37
38 template <typename T>
39 unused_type const&
40 operator=(T const&) const
41 {
42 return *this;
43 }
44
45 template <typename T>
46 unused_type&
47 operator=(T const&)
48 {
49 return *this;
50 }
51
52 unused_type const&
53 operator=(unused_type const&) const
54 {
55 return *this;
56 }
57
58 unused_type&
59 operator=(unused_type const&)
60 {
61 return *this;
62 }
63
64 // unused_type can also masquerade as an empty context (see context.hpp)
65
66 template <typename ID>
67 struct get_result : mpl::identity<unused_type> {};
68
69 template <typename ID>
70 unused_type get(ID) const
71 {
72 return unused_type();
73 }
74 };
75
76 unused_type const unused = unused_type();
77
78 inline std::ostream& operator<<(std::ostream& out, unused_type const&)
79 {
80 return out;
81 }
82
83 inline std::istream& operator>>(std::istream& in, unused_type&)
84 {
85 return in;
86 }
87 }}}
88
89 #if defined(BOOST_MSVC)
90 # pragma warning(pop)
91 #endif
92
93 #endif