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 <iosfwd> 12 13 /////////////////////////////////////////////////////////////////////////////// 14 namespace boost { namespace spirit { namespace x3 15 { 16 struct unused_type 17 { 18 unused_type() = default; 19 20 template <typename T> unused_typeboost::spirit::x3::unused_type21 unused_type(T const&) 22 { 23 } 24 25 template <typename T> 26 unused_type const& operator =boost::spirit::x3::unused_type27 operator=(T const&) const 28 { 29 return *this; 30 } 31 32 template <typename T> 33 unused_type& operator =boost::spirit::x3::unused_type34 operator=(T const&) 35 { 36 return *this; 37 } 38 39 // unused_type can also masquerade as an empty context (see context.hpp) 40 41 template <typename ID> getboost::spirit::x3::unused_type42 unused_type get(ID) const 43 { 44 return {}; 45 } 46 operator <<(std::ostream & out,unused_type const &)47 friend std::ostream& operator<<(std::ostream& out, unused_type const&) 48 { 49 return out; 50 } 51 operator >>(std::istream & in,unused_type &)52 friend std::istream& operator>>(std::istream& in, unused_type&) 53 { 54 return in; 55 } 56 }; 57 58 constexpr auto unused = unused_type{}; 59 }}} 60 61 #endif 62