epoc32/include/stdapis/boost/variant/static_visitor.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 //-----------------------------------------------------------------------------
     2 // boost variant/static_visitor.hpp header file
     3 // See http://www.boost.org for updates, documentation, and revision history.
     4 //-----------------------------------------------------------------------------
     5 //
     6 // Copyright (c) 2002-2003
     7 // Eric Friedman
     8 //
     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)
    12 
    13 #ifndef BOOST_VARIANT_STATIC_VISITOR_HPP
    14 #define BOOST_VARIANT_STATIC_VISITOR_HPP
    15 
    16 #include "boost/config.hpp"
    17 #include "boost/detail/workaround.hpp"
    18 
    19 #include "boost/mpl/if.hpp"
    20 #include "boost/type_traits/is_base_and_derived.hpp"
    21 
    22 #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
    23 #   include "boost/type_traits/is_same.hpp"
    24 #endif
    25 
    26 // should be the last #include
    27 #include "boost/type_traits/detail/bool_trait_def.hpp"
    28 
    29 namespace boost {
    30 
    31 //////////////////////////////////////////////////////////////////////////
    32 // class template static_visitor
    33 //
    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.
    36 //
    37 
    38 namespace detail {
    39 
    40     struct is_static_visitor_tag { };
    41 
    42     typedef void static_visitor_default_return;
    43 
    44 } // namespace detail
    45 
    46 template <typename R = ::boost::detail::static_visitor_default_return>
    47 class static_visitor
    48     : public detail::is_static_visitor_tag
    49 {
    50 public: // typedefs
    51 
    52     typedef R result_type;
    53 
    54 protected: // for use as base class only
    55 
    56     static_visitor() { }
    57     ~static_visitor() { }
    58 
    59 };
    60 
    61 //////////////////////////////////////////////////////////////////////////
    62 // metafunction is_static_visitor
    63 //
    64 // Value metafunction indicates whether the specified type derives from
    65 // static_visitor<...>.
    66 //
    67 // NOTE #1: This metafunction does NOT check whether the specified type
    68 //  fulfills the requirements of the StaticVisitor concept.
    69 //
    70 // NOTE #2: This template never needs to be specialized!
    71 //
    72 
    73 namespace detail {
    74 
    75 template <typename T>
    76 struct is_static_visitor_impl
    77 {
    78     BOOST_STATIC_CONSTANT(bool, value = 
    79         (::boost::is_base_and_derived< 
    80             detail::is_static_visitor_tag,
    81             T
    82         >::value));
    83 };
    84 
    85 } // namespace detail
    86 
    87 BOOST_TT_AUX_BOOL_TRAIT_DEF1(
    88       is_static_visitor
    89     , T
    90     , (::boost::detail::is_static_visitor_impl<T>::value)
    91     )
    92 
    93 } // namespace boost
    94 
    95 #include "boost/type_traits/detail/bool_trait_undef.hpp"
    96 
    97 #endif // BOOST_VARIANT_STATIC_VISITOR_HPP