Chris@16: /*============================================================================= Chris@16: Copyright (c) 2001-2011 Joel de Guzman Chris@16: Copyright (c) 2001-2011 Hartmut Kaiser Chris@16: Chris@16: Distributed under the Boost Software License, Version 1.0. (See accompanying Chris@16: file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: ==============================================================================*/ Chris@16: #if !defined(BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM) Chris@16: #define BOOST_SPIRIT_UNUSED_APRIL_16_2006_0616PM Chris@16: Chris@16: #if defined(_MSC_VER) Chris@16: #pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: #if defined(BOOST_MSVC) Chris@16: # pragma warning(push) Chris@16: # pragma warning(disable: 4522) // multiple assignment operators specified warning Chris@16: #endif Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////////// Chris@16: namespace boost { namespace spirit Chris@16: { Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // We do not import fusion ::unused_type anymore to avoid boost::fusion Chris@16: // being turned into an associate namespace for boost::spirit, as this Chris@16: // interferes with ADL in unexpected ways. We rather copy the full Chris@16: // unused_type implementation from boost::fusion. Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: struct unused_type Chris@16: { Chris@16: unused_type() Chris@16: { Chris@16: } Chris@16: Chris@16: template Chris@16: unused_type(T const&) Chris@16: { Chris@16: } Chris@16: Chris@16: template Chris@16: unused_type const& Chris@16: operator=(T const&) const Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: Chris@16: template Chris@16: unused_type& Chris@16: operator=(T const&) Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: Chris@16: unused_type const& Chris@16: operator=(unused_type const&) const Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: Chris@16: unused_type& Chris@16: operator=(unused_type const&) Chris@16: { Chris@16: return *this; Chris@16: } Chris@16: }; Chris@16: Chris@16: unused_type const unused = unused_type(); Chris@16: Chris@16: namespace detail Chris@16: { Chris@16: struct unused_only Chris@16: { Chris@16: unused_only(unused_type const&) {} Chris@16: }; Chris@16: } Chris@16: Chris@16: template Chris@16: inline Out& operator<<(Out& out, detail::unused_only const&) Chris@16: { Chris@16: return out; Chris@16: } Chris@16: Chris@16: template Chris@16: inline In& operator>>(In& in, unused_type&) Chris@16: { Chris@16: return in; Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: namespace traits Chris@16: { Chris@16: // We use this test to detect if the argument is not an unused_type Chris@16: template struct not_is_unused : mpl::true_ {}; Chris@16: template <> struct not_is_unused : mpl::false_ {}; Chris@16: } Chris@16: }} Chris@16: Chris@16: #if defined(BOOST_MSVC) Chris@16: # pragma warning(pop) Chris@16: #endif Chris@16: Chris@16: #endif