sl@0: //----------------------------------------------------------------------------- sl@0: // boost detail/reference_content.hpp header file sl@0: // See http://www.boost.org for updates, documentation, and revision history. sl@0: //----------------------------------------------------------------------------- sl@0: // sl@0: // Copyright (c) 2003 sl@0: // Eric Friedman sl@0: // sl@0: // Distributed under the Boost Software License, Version 1.0. (See sl@0: // accompanying file LICENSE_1_0.txt or copy at sl@0: // http://www.boost.org/LICENSE_1_0.txt) sl@0: sl@0: #ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP sl@0: #define BOOST_DETAIL_REFERENCE_CONTENT_HPP sl@0: sl@0: #include "boost/config.hpp" sl@0: sl@0: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: # include "boost/mpl/bool.hpp" sl@0: # include "boost/type_traits/has_nothrow_copy.hpp" sl@0: #else sl@0: # include "boost/mpl/if.hpp" sl@0: # include "boost/type_traits/is_reference.hpp" sl@0: #endif sl@0: sl@0: #include "boost/mpl/void.hpp" sl@0: sl@0: namespace boost { sl@0: sl@0: namespace detail { sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // (detail) class template reference_content sl@0: // sl@0: // Non-Assignable wrapper for references. sl@0: // sl@0: template sl@0: class reference_content sl@0: { sl@0: private: // representation sl@0: sl@0: RefT content_; sl@0: sl@0: public: // structors sl@0: sl@0: ~reference_content() sl@0: { sl@0: } sl@0: sl@0: reference_content(RefT r) sl@0: : content_( r ) sl@0: { sl@0: } sl@0: sl@0: reference_content(const reference_content& operand) sl@0: : content_( operand.content_ ) sl@0: { sl@0: } sl@0: sl@0: private: // non-Assignable sl@0: sl@0: reference_content& operator=(const reference_content&); sl@0: sl@0: public: // queries sl@0: sl@0: RefT get() const sl@0: { sl@0: return content_; sl@0: } sl@0: sl@0: }; sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // (detail) metafunction make_reference_content sl@0: // sl@0: // Wraps with reference_content if specified type is reference. sl@0: // sl@0: sl@0: template struct make_reference_content; sl@0: sl@0: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: template sl@0: struct make_reference_content sl@0: { sl@0: typedef T type; sl@0: }; sl@0: sl@0: template sl@0: struct make_reference_content< T& > sl@0: { sl@0: typedef reference_content type; sl@0: }; sl@0: sl@0: #else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: template sl@0: struct make_reference_content sl@0: : mpl::if_< sl@0: is_reference sl@0: , reference_content sl@0: , T sl@0: > sl@0: { sl@0: }; sl@0: sl@0: #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround sl@0: sl@0: template <> sl@0: struct make_reference_content< mpl::void_ > sl@0: { sl@0: template sl@0: struct apply sl@0: : make_reference_content sl@0: { sl@0: }; sl@0: sl@0: typedef mpl::void_ type; sl@0: }; sl@0: sl@0: } // namespace detail sl@0: sl@0: /////////////////////////////////////////////////////////////////////////////// sl@0: // reference_content type traits specializations sl@0: // sl@0: sl@0: #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: template sl@0: struct has_nothrow_copy< sl@0: ::boost::detail::reference_content< T& > sl@0: > sl@0: : mpl::true_ sl@0: { sl@0: }; sl@0: sl@0: #endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) sl@0: sl@0: } // namespace boost sl@0: sl@0: #endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP