annotate DEPENDENCIES/generic/include/boost/spirit/home/support/unused.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2001-2011 Joel de Guzman
Chris@16 3 Copyright (c) 2001-2011 Hartmut Kaiser
Chris@16 4
Chris@16 5 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 6 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 7 ==============================================================================*/
Chris@16 8 #if !defined(BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM)
Chris@16 9 #define BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM
Chris@16 10
Chris@16 11 #if defined(_MSC_VER)
Chris@16 12 #pragma once
Chris@16 13 #endif
Chris@16 14
Chris@16 15 #include <boost/config.hpp>
Chris@16 16 #include <boost/mpl/bool.hpp>
Chris@16 17
Chris@16 18 #if defined(BOOST_MSVC)
Chris@16 19 # pragma warning(push)
Chris@16 20 # pragma warning(disable: 4522) // multiple assignment operators specified warning
Chris@16 21 #endif
Chris@16 22
Chris@16 23 ///////////////////////////////////////////////////////////////////////////////
Chris@16 24 namespace boost { namespace spirit
Chris@16 25 {
Chris@16 26 ///////////////////////////////////////////////////////////////////////////
Chris@16 27 // We do not import fusion ::unused_type anymore to avoid boost::fusion
Chris@16 28 // being turned into an associate namespace for boost::spirit, as this
Chris@16 29 // interferes with ADL in unexpected ways. We rather copy the full
Chris@16 30 // unused_type implementation from boost::fusion.
Chris@16 31 ///////////////////////////////////////////////////////////////////////////
Chris@16 32 struct unused_type
Chris@16 33 {
Chris@16 34 unused_type()
Chris@16 35 {
Chris@16 36 }
Chris@16 37
Chris@16 38 template <typename T>
Chris@16 39 unused_type(T const&)
Chris@16 40 {
Chris@16 41 }
Chris@16 42
Chris@16 43 template <typename T>
Chris@16 44 unused_type const&
Chris@16 45 operator=(T const&) const
Chris@16 46 {
Chris@16 47 return *this;
Chris@16 48 }
Chris@16 49
Chris@16 50 template <typename T>
Chris@16 51 unused_type&
Chris@16 52 operator=(T const&)
Chris@16 53 {
Chris@16 54 return *this;
Chris@16 55 }
Chris@16 56
Chris@16 57 unused_type const&
Chris@16 58 operator=(unused_type const&) const
Chris@16 59 {
Chris@16 60 return *this;
Chris@16 61 }
Chris@16 62
Chris@16 63 unused_type&
Chris@16 64 operator=(unused_type const&)
Chris@16 65 {
Chris@16 66 return *this;
Chris@16 67 }
Chris@16 68 };
Chris@16 69
Chris@16 70 unused_type const unused = unused_type();
Chris@16 71
Chris@16 72 namespace detail
Chris@16 73 {
Chris@16 74 struct unused_only
Chris@16 75 {
Chris@16 76 unused_only(unused_type const&) {}
Chris@16 77 };
Chris@16 78 }
Chris@16 79
Chris@16 80 template <typename Out>
Chris@16 81 inline Out& operator<<(Out& out, detail::unused_only const&)
Chris@16 82 {
Chris@16 83 return out;
Chris@16 84 }
Chris@16 85
Chris@16 86 template <typename In>
Chris@16 87 inline In& operator>>(In& in, unused_type&)
Chris@16 88 {
Chris@16 89 return in;
Chris@16 90 }
Chris@16 91
Chris@16 92 ///////////////////////////////////////////////////////////////////////////
Chris@16 93 namespace traits
Chris@16 94 {
Chris@16 95 // We use this test to detect if the argument is not an unused_type
Chris@16 96 template <typename T> struct not_is_unused : mpl::true_ {};
Chris@16 97 template <> struct not_is_unused<unused_type> : mpl::false_ {};
Chris@16 98 }
Chris@16 99 }}
Chris@16 100
Chris@16 101 #if defined(BOOST_MSVC)
Chris@16 102 # pragma warning(pop)
Chris@16 103 #endif
Chris@16 104
Chris@16 105 #endif