Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
00014 #define BOOST_DETAIL_REFERENCE_CONTENT_HPP
00015
00016 #include "boost/config.hpp"
00017
00018 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
00019 # include "boost/mpl/bool.hpp"
00020 # include "boost/type_traits/has_nothrow_copy.hpp"
00021 #else
00022 # include "boost/mpl/if.hpp"
00023 # include "boost/type_traits/is_reference.hpp"
00024 #endif
00025
00026 #include "boost/mpl/void.hpp"
00027
00028 namespace boost {
00029
00030 namespace detail {
00031
00033
00034
00035
00036
00037 template <typename RefT>
00038 class reference_content
00039 {
00040 private:
00041
00042 RefT content_;
00043
00044 public:
00045
00046 ~reference_content()
00047 {
00048 }
00049
00050 reference_content(RefT r)
00051 : content_( r )
00052 {
00053 }
00054
00055 reference_content(const reference_content& operand)
00056 : content_( operand.content_ )
00057 {
00058 }
00059
00060 private:
00061
00062 reference_content& operator=(const reference_content&);
00063
00064 public:
00065
00066 RefT get() const
00067 {
00068 return content_;
00069 }
00070
00071 };
00072
00074
00075
00076
00077
00078
00079 template <typename T = mpl::void_> struct make_reference_content;
00080
00081 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
00082
00083 template <typename T>
00084 struct make_reference_content
00085 {
00086 typedef T type;
00087 };
00088
00089 template <typename T>
00090 struct make_reference_content< T& >
00091 {
00092 typedef reference_content<T&> type;
00093 };
00094
00095 #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
00096
00097 template <typename T>
00098 struct make_reference_content
00099 : mpl::if_<
00100 is_reference<T>
00101 , reference_content<T>
00102 , T
00103 >
00104 {
00105 };
00106
00107 #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
00108
00109 template <>
00110 struct make_reference_content< mpl::void_ >
00111 {
00112 template <typename T>
00113 struct apply
00114 : make_reference_content<T>
00115 {
00116 };
00117
00118 typedef mpl::void_ type;
00119 };
00120
00121 }
00122
00124
00125
00126
00127 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
00128
00129 template <typename T>
00130 struct has_nothrow_copy<
00131 ::boost::detail::reference_content< T& >
00132 >
00133 : mpl::true_
00134 {
00135 };
00136
00137 #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
00138
00139 }
00140
00141 #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP