1 //-----------------------------------------------------------------------------
2 // boost variant/static_visitor.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
6 // Copyright (c) 2002-2003
9 // Distributed under the Boost Software License, Version 1.0. (See
10 // accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 #ifndef BOOST_VARIANT_STATIC_VISITOR_HPP
14 #define BOOST_VARIANT_STATIC_VISITOR_HPP
16 #include "boost/config.hpp"
17 #include "boost/detail/workaround.hpp"
19 #include "boost/mpl/if.hpp"
20 #include "boost/type_traits/is_base_and_derived.hpp"
22 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
23 # include "boost/type_traits/is_same.hpp"
26 // should be the last #include
27 #include "boost/type_traits/detail/bool_trait_def.hpp"
31 //////////////////////////////////////////////////////////////////////////
32 // class template static_visitor
34 // An empty base class that typedefs the return type of a deriving static
35 // visitor. The class is analogous to std::unary_function in this role.
40 struct is_static_visitor_tag
{ };
42 typedef void static_visitor_default_return
;
46 template <typename R
= ::boost::detail::static_visitor_default_return
>
48 : public detail::is_static_visitor_tag
52 typedef R result_type
;
54 protected: // for use as base class only
61 //////////////////////////////////////////////////////////////////////////
62 // metafunction is_static_visitor
64 // Value metafunction indicates whether the specified type derives from
65 // static_visitor<...>.
67 // NOTE #1: This metafunction does NOT check whether the specified type
68 // fulfills the requirements of the StaticVisitor concept.
70 // NOTE #2: This template never needs to be specialized!
76 struct is_static_visitor_impl
78 BOOST_STATIC_CONSTANT(bool, value
=
79 (::boost::is_base_and_derived
<
80 detail::is_static_visitor_tag
,
87 BOOST_TT_AUX_BOOL_TRAIT_DEF1(
90 , (::boost::detail::is_static_visitor_impl
<T
>::value
)
95 #include "boost/type_traits/detail/bool_trait_undef.hpp"
97 #endif // BOOST_VARIANT_STATIC_VISITOR_HPP