From 2bc5f0cb060cfc285ad3f13e9fc6a02cc2417552 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Sun, 20 Nov 2005 18:07:53 +0000 Subject: [PATCH] Remove the broken reference_wrapper [SVN r2754] --- include/boost/ref.hpp | 249 ------------------------------------------ 1 file changed, 249 deletions(-) delete mode 100644 include/boost/ref.hpp diff --git a/include/boost/ref.hpp b/include/boost/ref.hpp deleted file mode 100644 index 5637545..0000000 --- a/include/boost/ref.hpp +++ /dev/null @@ -1,249 +0,0 @@ -#ifndef BOOST_REF_HPP_INCLUDED -# define BOOST_REF_HPP_INCLUDED - -# if _MSC_VER+0 >= 1020 -# pragma once -# endif - -# include -# include -# include -# include -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include -# endif -# include -# include - -// -// ref.hpp - ref/cref, useful helper functions -// -// Copyright (C) 1999, 2000 Jaakko Järvi (jaakko.jarvi@cs.utu.fi) -// Copyright (C) 2001, 2002 Peter Dimov -// Copyright (C) 2002 David Abrahams -// Copyright (C) 2003 Doug Gregor -// -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. -// This software is provided "as is" without express or implied -// warranty, and with no claim as to its suitability for any purpose. -// -// See http://www.boost.org/libs/bind/ref.html for documentation. -// - -# ifndef BOOST_REF_NUM_ARGS -# define BOOST_REF_NUM_ARGS 10 -# endif - -namespace boost -{ - -namespace detail { namespace ref { - -template -class reference_wrapper_without_result_type -{ -public: - template - struct result_of -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - : boost::result_of -# endif - { - }; - - operator T& () const { return *(this->t_); } - T& get() const { return *(this->t_); } - T* get_pointer() const { return this->t_; } - -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_REF_NUM_ARGS,)) -# include BOOST_PP_ITERATE() -# endif - -protected: -# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) - explicit reference_wrapper_without_result_type(T& t) : t_(&t) {} -# else - explicit reference_wrapper_without_result_type(T& t) : t_(addressof(t)) {} -# endif - -private: - T* t_; -}; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -class reference_wrapper_with_result_type -{ -public: - typedef typename T::result_type result_type; - - operator T& () const { return *(this->t_); } - T& get() const { return *(this->t_); } - T* get_pointer() const { return this->t_; } - - result_type operator()() const { return get()(); } - -# if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -# define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_REF_NUM_ARGS,)) -# include BOOST_PP_ITERATE() -# endif - -protected: -# if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) - explicit reference_wrapper_with_result_type(T& t) : t_(&t) {} -# else - explicit reference_wrapper_with_result_type(T& t) : t_(addressof(t)) {} -# endif - -private: - T* t_; -}; - -template -class reference_wrapper_impl : - public ct_if<(has_result_type::value), - reference_wrapper_with_result_type, - reference_wrapper_without_result_type >::type -{ - typedef typename ct_if<(has_result_type::value), - reference_wrapper_with_result_type, - reference_wrapper_without_result_type >::type - inherited; - -protected: - reference_wrapper_impl(T& t) : inherited(t) {} -}; -# else -template -class reference_wrapper_impl : public reference_wrapper_without_result_type -{ - typedef reference_wrapper_without_result_type inherited; - -protected: - reference_wrapper_impl(T& t) : inherited(t) {} -}; -# endif - -} } // end namespace detail::ref - -template -class reference_wrapper : public detail::ref::reference_wrapper_impl -{ - typedef detail::ref::reference_wrapper_impl inherited; - -public: - typedef T type; - - explicit reference_wrapper(T& t) : inherited(t) {} -}; - -# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x570) -# define BOOST_REF_CONST -# else -# define BOOST_REF_CONST const -# endif - -template inline reference_wrapper BOOST_REF_CONST ref(T & t) -{ - return reference_wrapper(t); -} - -template inline reference_wrapper BOOST_REF_CONST cref(T const & t) -{ - return reference_wrapper(t); -} - -# undef BOOST_REF_CONST - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template -class is_reference_wrapper -{ - public: - BOOST_STATIC_CONSTANT(bool, value = false); -}; - -template -class is_reference_wrapper > -{ - public: - BOOST_STATIC_CONSTANT(bool, value = true); -}; - -template -class unwrap_reference -{ - public: - typedef T type; -}; - -template -class unwrap_reference > -{ - public: - typedef T type; -}; -# else // no partial specialization - -} // namespace boost - -namespace boost -{ - -namespace detail -{ - typedef char (&yes_reference_wrapper_t)[1]; - typedef char (&no_reference_wrapper_t)[2]; - - no_reference_wrapper_t is_reference_wrapper_test(...); - - template - yes_reference_wrapper_t - is_reference_wrapper_test(type< reference_wrapper >); - - template - struct reference_unwrapper - { - template - struct apply - { - typedef T type; - }; - }; - - template<> - struct reference_unwrapper - { - template - struct apply - { - typedef typename T::type type; - }; - }; -} - -template -class is_reference_wrapper -{ - public: - BOOST_STATIC_CONSTANT( - bool, value = ( - sizeof(detail::is_reference_wrapper_test(type())) - == sizeof(detail::yes_reference_wrapper_t))); -}; - -template -class unwrap_reference - : public detail::reference_unwrapper< - is_reference_wrapper::value - >::template apply -{}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -} // namespace boost - -#endif // #ifndef BOOST_REF_HPP_INCLUDED