fix doc example typo
[boost.git] / boost / detail / reference_content.hpp
blobdaf56a8b19330d75efbea315bd7809db4fb96c6c
1 //-----------------------------------------------------------------------------
2 // boost detail/reference_content.hpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
5 //
6 // Copyright (c) 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)
13 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
14 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP
16 #include "boost/config.hpp"
18 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
19 # include "boost/mpl/bool.hpp"
20 # include "boost/type_traits/has_nothrow_copy.hpp"
21 #else
22 # include "boost/mpl/if.hpp"
23 # include "boost/type_traits/is_reference.hpp"
24 #endif
26 #include "boost/mpl/void.hpp"
28 namespace boost {
30 namespace detail {
32 ///////////////////////////////////////////////////////////////////////////////
33 // (detail) class template reference_content
35 // Non-Assignable wrapper for references.
37 template <typename RefT>
38 class reference_content
40 private: // representation
42 RefT content_;
44 public: // structors
46 ~reference_content()
50 reference_content(RefT r)
51 : content_( r )
55 reference_content(const reference_content& operand)
56 : content_( operand.content_ )
60 private: // non-Assignable
62 reference_content& operator=(const reference_content&);
64 public: // queries
66 RefT get() const
68 return content_;
73 ///////////////////////////////////////////////////////////////////////////////
74 // (detail) metafunction make_reference_content
76 // Wraps with reference_content if specified type is reference.
79 template <typename T = mpl::void_> struct make_reference_content;
81 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
83 template <typename T>
84 struct make_reference_content
86 typedef T type;
89 template <typename T>
90 struct make_reference_content< T& >
92 typedef reference_content<T&> type;
95 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
97 template <typename T>
98 struct make_reference_content
99 : mpl::if_<
100 is_reference<T>
101 , reference_content<T>
107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
109 template <>
110 struct make_reference_content< mpl::void_ >
112 template <typename T>
113 struct apply
114 : make_reference_content<T>
118 typedef mpl::void_ type;
121 } // namespace detail
123 ///////////////////////////////////////////////////////////////////////////////
124 // reference_content<T&> type traits specializations
127 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
129 template <typename T>
130 struct has_nothrow_copy<
131 ::boost::detail::reference_content< T& >
133 : mpl::true_
137 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
139 } // namespace boost
141 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP