Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:30:42

0001 //-----------------------------------------------------------------------------
0002 // boost detail/reference_content.hpp header file
0003 // See http://www.boost.org for updates, documentation, and revision history.
0004 //-----------------------------------------------------------------------------
0005 //
0006 // Copyright (c) 2003
0007 // Eric Friedman
0008 //
0009 // Distributed under the Boost Software License, Version 1.0. (See
0010 // accompanying file LICENSE_1_0.txt or copy at
0011 // http://www.boost.org/LICENSE_1_0.txt)
0012 
0013 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
0014 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP
0015 
0016 #include "boost/config.hpp"
0017 
0018 #   include "boost/type_traits/integral_constant.hpp"
0019 #   include "boost/type_traits/has_nothrow_copy.hpp"
0020 
0021 namespace boost {
0022 
0023 namespace detail {
0024 
0025 struct void_type {};
0026 
0027 ///////////////////////////////////////////////////////////////////////////////
0028 // (detail) class template reference_content
0029 //
0030 // Non-Assignable wrapper for references.
0031 //
0032 template <typename RefT>
0033 class reference_content
0034 {
0035 private: // representation
0036 
0037     RefT content_;
0038 
0039 public: // structors
0040 
0041     ~reference_content()
0042     {
0043     }
0044 
0045     reference_content(RefT r)
0046         : content_( r )
0047     {
0048     }
0049 
0050     reference_content(const reference_content& operand)
0051         : content_( operand.content_ )
0052     {
0053     }
0054 
0055 private: // non-Assignable
0056 
0057     reference_content& operator=(const reference_content&);
0058 
0059 public: // queries
0060 
0061     RefT get() const
0062     {
0063         return content_;
0064     }
0065 
0066 };
0067 
0068 ///////////////////////////////////////////////////////////////////////////////
0069 // (detail) metafunction make_reference_content
0070 //
0071 // Wraps with reference_content if specified type is reference.
0072 //
0073 
0074 template <typename T = void_type> struct make_reference_content;
0075 
0076 
0077 template <typename T>
0078 struct make_reference_content
0079 {
0080     typedef T type;
0081 };
0082 
0083 template <typename T>
0084 struct make_reference_content< T& >
0085 {
0086     typedef reference_content<T&> type;
0087 };
0088 
0089 
0090 template <>
0091 struct make_reference_content< void_type >
0092 {
0093     template <typename T>
0094     struct apply
0095         : make_reference_content<T>
0096     {
0097     };
0098 
0099     typedef void_type type;
0100 };
0101 
0102 } // namespace detail
0103 
0104 ///////////////////////////////////////////////////////////////////////////////
0105 // reference_content<T&> type traits specializations
0106 //
0107 
0108 
0109 template <typename T>
0110 struct has_nothrow_copy<
0111       ::boost::detail::reference_content< T& >
0112     >
0113     : boost::true_type
0114 {
0115 };
0116 
0117 
0118 } // namespace boost
0119 
0120 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP