Chris@16: //----------------------------------------------------------------------------- Chris@16: // boost variant/static_visitor.hpp header file Chris@16: // See http://www.boost.org for updates, documentation, and revision history. Chris@16: //----------------------------------------------------------------------------- Chris@16: // Chris@16: // Copyright (c) 2002-2003 Chris@16: // Eric Friedman Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_VARIANT_STATIC_VISITOR_HPP Chris@16: #define BOOST_VARIANT_STATIC_VISITOR_HPP Chris@16: Chris@16: #include "boost/config.hpp" Chris@16: #include "boost/detail/workaround.hpp" Chris@16: Chris@16: #include "boost/mpl/if.hpp" Chris@16: #include "boost/type_traits/is_base_and_derived.hpp" Chris@16: Chris@16: // should be the last #include Chris@16: #include "boost/type_traits/detail/bool_trait_def.hpp" Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: ////////////////////////////////////////////////////////////////////////// Chris@16: // class template static_visitor Chris@16: // Chris@16: // An empty base class that typedefs the return type of a deriving static Chris@16: // visitor. The class is analogous to std::unary_function in this role. Chris@16: // Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: struct is_static_visitor_tag { }; Chris@16: Chris@16: typedef void static_visitor_default_return; Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: template Chris@16: class static_visitor Chris@16: : public detail::is_static_visitor_tag Chris@16: { Chris@16: public: // typedefs Chris@16: Chris@16: typedef R result_type; Chris@16: Chris@16: protected: // for use as base class only Chris@101: #if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) Chris@101: static_visitor() = default; Chris@101: ~static_visitor() = default; Chris@101: #else Chris@101: static_visitor() BOOST_NOEXCEPT { } Chris@101: ~static_visitor() BOOST_NOEXCEPT { } Chris@101: #endif Chris@16: }; Chris@16: Chris@16: ////////////////////////////////////////////////////////////////////////// Chris@16: // metafunction is_static_visitor Chris@16: // Chris@16: // Value metafunction indicates whether the specified type derives from Chris@16: // static_visitor<...>. Chris@16: // Chris@16: // NOTE #1: This metafunction does NOT check whether the specified type Chris@16: // fulfills the requirements of the StaticVisitor concept. Chris@16: // Chris@16: // NOTE #2: This template never needs to be specialized! Chris@16: // Chris@16: Chris@16: namespace detail { Chris@16: Chris@16: template Chris@16: struct is_static_visitor_impl Chris@16: { Chris@16: BOOST_STATIC_CONSTANT(bool, value = Chris@16: (::boost::is_base_and_derived< Chris@16: detail::is_static_visitor_tag, Chris@16: T Chris@16: >::value)); Chris@16: }; Chris@16: Chris@16: } // namespace detail Chris@16: Chris@16: BOOST_TT_AUX_BOOL_TRAIT_DEF1( Chris@16: is_static_visitor Chris@16: , T Chris@16: , (::boost::detail::is_static_visitor_impl::value) Chris@16: ) Chris@16: Chris@16: } // namespace boost Chris@16: Chris@16: #include "boost/type_traits/detail/bool_trait_undef.hpp" Chris@16: Chris@16: #endif // BOOST_VARIANT_STATIC_VISITOR_HPP