os/ossrv/ossrv_pub/boost_apis/boost/detail/reference_content.hpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
//-----------------------------------------------------------------------------
sl@0
     2
// boost detail/reference_content.hpp header file
sl@0
     3
// See http://www.boost.org for updates, documentation, and revision history.
sl@0
     4
//-----------------------------------------------------------------------------
sl@0
     5
//
sl@0
     6
// Copyright (c) 2003
sl@0
     7
// Eric Friedman
sl@0
     8
//
sl@0
     9
// Distributed under the Boost Software License, Version 1.0. (See
sl@0
    10
// accompanying file LICENSE_1_0.txt or copy at
sl@0
    11
// http://www.boost.org/LICENSE_1_0.txt)
sl@0
    12
sl@0
    13
#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
sl@0
    14
#define BOOST_DETAIL_REFERENCE_CONTENT_HPP
sl@0
    15
sl@0
    16
#include "boost/config.hpp"
sl@0
    17
sl@0
    18
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
    19
#   include "boost/mpl/bool.hpp"
sl@0
    20
#   include "boost/type_traits/has_nothrow_copy.hpp"
sl@0
    21
#else
sl@0
    22
#   include "boost/mpl/if.hpp"
sl@0
    23
#   include "boost/type_traits/is_reference.hpp"
sl@0
    24
#endif
sl@0
    25
sl@0
    26
#include "boost/mpl/void.hpp"
sl@0
    27
sl@0
    28
namespace boost {
sl@0
    29
sl@0
    30
namespace detail {
sl@0
    31
sl@0
    32
///////////////////////////////////////////////////////////////////////////////
sl@0
    33
// (detail) class template reference_content
sl@0
    34
//
sl@0
    35
// Non-Assignable wrapper for references.
sl@0
    36
//
sl@0
    37
template <typename RefT>
sl@0
    38
class reference_content
sl@0
    39
{
sl@0
    40
private: // representation
sl@0
    41
sl@0
    42
    RefT content_;
sl@0
    43
sl@0
    44
public: // structors
sl@0
    45
sl@0
    46
    ~reference_content()
sl@0
    47
    {
sl@0
    48
    }
sl@0
    49
sl@0
    50
    reference_content(RefT r)
sl@0
    51
        : content_( r )
sl@0
    52
    {
sl@0
    53
    }
sl@0
    54
sl@0
    55
    reference_content(const reference_content& operand)
sl@0
    56
        : content_( operand.content_ )
sl@0
    57
    {
sl@0
    58
    }
sl@0
    59
sl@0
    60
private: // non-Assignable
sl@0
    61
sl@0
    62
    reference_content& operator=(const reference_content&);
sl@0
    63
sl@0
    64
public: // queries
sl@0
    65
sl@0
    66
    RefT get() const
sl@0
    67
    {
sl@0
    68
        return content_;
sl@0
    69
    }
sl@0
    70
sl@0
    71
};
sl@0
    72
sl@0
    73
///////////////////////////////////////////////////////////////////////////////
sl@0
    74
// (detail) metafunction make_reference_content
sl@0
    75
//
sl@0
    76
// Wraps with reference_content if specified type is reference.
sl@0
    77
//
sl@0
    78
sl@0
    79
template <typename T = mpl::void_> struct make_reference_content;
sl@0
    80
sl@0
    81
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
    82
sl@0
    83
template <typename T>
sl@0
    84
struct make_reference_content
sl@0
    85
{
sl@0
    86
    typedef T type;
sl@0
    87
};
sl@0
    88
sl@0
    89
template <typename T>
sl@0
    90
struct make_reference_content< T& >
sl@0
    91
{
sl@0
    92
    typedef reference_content<T&> type;
sl@0
    93
};
sl@0
    94
sl@0
    95
#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
    96
sl@0
    97
template <typename T>
sl@0
    98
struct make_reference_content
sl@0
    99
    : mpl::if_<
sl@0
   100
          is_reference<T>
sl@0
   101
        , reference_content<T>
sl@0
   102
        , T
sl@0
   103
        >
sl@0
   104
{
sl@0
   105
};
sl@0
   106
sl@0
   107
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
sl@0
   108
sl@0
   109
template <>
sl@0
   110
struct make_reference_content< mpl::void_ >
sl@0
   111
{
sl@0
   112
    template <typename T>
sl@0
   113
    struct apply
sl@0
   114
        : make_reference_content<T>
sl@0
   115
    {
sl@0
   116
    };
sl@0
   117
sl@0
   118
    typedef mpl::void_ type;
sl@0
   119
};
sl@0
   120
sl@0
   121
} // namespace detail
sl@0
   122
sl@0
   123
///////////////////////////////////////////////////////////////////////////////
sl@0
   124
// reference_content<T&> type traits specializations
sl@0
   125
//
sl@0
   126
sl@0
   127
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
   128
sl@0
   129
template <typename T>
sl@0
   130
struct has_nothrow_copy<
sl@0
   131
      ::boost::detail::reference_content< T& >
sl@0
   132
    >
sl@0
   133
    : mpl::true_
sl@0
   134
{
sl@0
   135
};
sl@0
   136
sl@0
   137
#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
sl@0
   138
sl@0
   139
} // namespace boost
sl@0
   140
sl@0
   141
#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP