Ticket #11517: unused.hpp

File unused.hpp, 2.6 KB (added by Ben Goodrich <goodrich.ben@…>, 7 years ago)
Line 
1/*=============================================================================
2 Copyright (c) 2001-2011 Joel de Guzman
3
4 Distributed under the Boost Software License, Version 1.0. (See accompanying
5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6==============================================================================*/
7#if !defined(BOOST_FUSION_SUPPORT_UNUSED_20070305_1038)
8#define BOOST_FUSION_SUPPORT_UNUSED_20070305_1038
9
10#include <boost/fusion/support/config.hpp>
11#include <iosfwd>
12
13#include <boost/config.hpp>
14#if defined(BOOST_MSVC)
15# pragma warning(push)
16# pragma warning(disable: 4522) // multiple assignment operators specified warning
17#endif
18
19#define BOOST_FUSION_UNUSED_HAS_IO
20
21namespace boost { namespace fusion
22{
23 struct unused_type
24 {
25 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
26 unused_type() BOOST_NOEXCEPT
27 {
28 }
29
30 template <typename T>
31 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
32 unused_type(T const&) BOOST_NOEXCEPT
33 {
34 }
35
36 template <typename T>
37 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
38 unused_type const&
39 operator=(T const&) const BOOST_NOEXCEPT
40 {
41 return *this;
42 }
43
44 template <typename T>
45 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
46 unused_type&
47 operator=(T const&) BOOST_NOEXCEPT
48 {
49 return *this;
50 }
51#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 6
52// nothing
53#else
54 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
55 unused_type const&
56 operator=(unused_type const&) const BOOST_NOEXCEPT
57 {
58 return *this;
59 }
60
61 BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
62 unused_type&
63 operator=(unused_type const&) BOOST_NOEXCEPT
64 {
65 return *this;
66 }
67#endif
68 };
69
70#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ == 4 && __GNUC_MINOR__ <= 6
71 BOOST_CONSTEXPR unused_type /*const*/ unused = unused_type();
72#else
73 BOOST_CONSTEXPR unused_type const unused = unused_type();
74#endif
75
76 namespace detail
77 {
78 struct unused_only
79 {
80 BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
81 unused_only(unused_type const&) BOOST_NOEXCEPT {}
82 };
83 }
84
85 BOOST_CONSTEXPR
86 inline std::ostream& operator<<(std::ostream& out, detail::unused_only const&) BOOST_NOEXCEPT
87 {
88 return out;
89 }
90
91 BOOST_CONSTEXPR
92 inline std::istream& operator>>(std::istream& in, unused_type&) BOOST_NOEXCEPT
93 {
94 return in;
95 }
96}}
97
98#if defined(BOOST_MSVC)
99# pragma warning(pop)
100#endif
101
102#endif