epoc32/include/stdapis/boost/detail/reference_content.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/detail/reference_content.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,141 @@
     1.4 +//-----------------------------------------------------------------------------
     1.5 +// boost detail/reference_content.hpp header file
     1.6 +// See http://www.boost.org for updates, documentation, and revision history.
     1.7 +//-----------------------------------------------------------------------------
     1.8 +//
     1.9 +// Copyright (c) 2003
    1.10 +// Eric Friedman
    1.11 +//
    1.12 +// Distributed under the Boost Software License, Version 1.0. (See
    1.13 +// accompanying file LICENSE_1_0.txt or copy at
    1.14 +// http://www.boost.org/LICENSE_1_0.txt)
    1.15 +
    1.16 +#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
    1.17 +#define BOOST_DETAIL_REFERENCE_CONTENT_HPP
    1.18 +
    1.19 +#include "boost/config.hpp"
    1.20 +
    1.21 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.22 +#   include "boost/mpl/bool.hpp"
    1.23 +#   include "boost/type_traits/has_nothrow_copy.hpp"
    1.24 +#else
    1.25 +#   include "boost/mpl/if.hpp"
    1.26 +#   include "boost/type_traits/is_reference.hpp"
    1.27 +#endif
    1.28 +
    1.29 +#include "boost/mpl/void.hpp"
    1.30 +
    1.31 +namespace boost {
    1.32 +
    1.33 +namespace detail {
    1.34 +
    1.35 +///////////////////////////////////////////////////////////////////////////////
    1.36 +// (detail) class template reference_content
    1.37 +//
    1.38 +// Non-Assignable wrapper for references.
    1.39 +//
    1.40 +template <typename RefT>
    1.41 +class reference_content
    1.42 +{
    1.43 +private: // representation
    1.44 +
    1.45 +    RefT content_;
    1.46 +
    1.47 +public: // structors
    1.48 +
    1.49 +    ~reference_content()
    1.50 +    {
    1.51 +    }
    1.52 +
    1.53 +    reference_content(RefT r)
    1.54 +        : content_( r )
    1.55 +    {
    1.56 +    }
    1.57 +
    1.58 +    reference_content(const reference_content& operand)
    1.59 +        : content_( operand.content_ )
    1.60 +    {
    1.61 +    }
    1.62 +
    1.63 +private: // non-Assignable
    1.64 +
    1.65 +    reference_content& operator=(const reference_content&);
    1.66 +
    1.67 +public: // queries
    1.68 +
    1.69 +    RefT get() const
    1.70 +    {
    1.71 +        return content_;
    1.72 +    }
    1.73 +
    1.74 +};
    1.75 +
    1.76 +///////////////////////////////////////////////////////////////////////////////
    1.77 +// (detail) metafunction make_reference_content
    1.78 +//
    1.79 +// Wraps with reference_content if specified type is reference.
    1.80 +//
    1.81 +
    1.82 +template <typename T = mpl::void_> struct make_reference_content;
    1.83 +
    1.84 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.85 +
    1.86 +template <typename T>
    1.87 +struct make_reference_content
    1.88 +{
    1.89 +    typedef T type;
    1.90 +};
    1.91 +
    1.92 +template <typename T>
    1.93 +struct make_reference_content< T& >
    1.94 +{
    1.95 +    typedef reference_content<T&> type;
    1.96 +};
    1.97 +
    1.98 +#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
    1.99 +
   1.100 +template <typename T>
   1.101 +struct make_reference_content
   1.102 +    : mpl::if_<
   1.103 +          is_reference<T>
   1.104 +        , reference_content<T>
   1.105 +        , T
   1.106 +        >
   1.107 +{
   1.108 +};
   1.109 +
   1.110 +#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
   1.111 +
   1.112 +template <>
   1.113 +struct make_reference_content< mpl::void_ >
   1.114 +{
   1.115 +    template <typename T>
   1.116 +    struct apply
   1.117 +        : make_reference_content<T>
   1.118 +    {
   1.119 +    };
   1.120 +
   1.121 +    typedef mpl::void_ type;
   1.122 +};
   1.123 +
   1.124 +} // namespace detail
   1.125 +
   1.126 +///////////////////////////////////////////////////////////////////////////////
   1.127 +// reference_content<T&> type traits specializations
   1.128 +//
   1.129 +
   1.130 +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
   1.131 +
   1.132 +template <typename T>
   1.133 +struct has_nothrow_copy<
   1.134 +      ::boost::detail::reference_content< T& >
   1.135 +    >
   1.136 +    : mpl::true_
   1.137 +{
   1.138 +};
   1.139 +
   1.140 +#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
   1.141 +
   1.142 +} // namespace boost
   1.143 +
   1.144 +#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP