Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-02-24 19:48:21


I'm going to check in the following patch to ref.hpp, which makes the
traits into valid MPL metafunctions. It introduces a dependency on
one new file (boost/mpl/bool_c.hpp), but that's truly the cleanest
way to get there. If there are any objections, I'm willing to employ
less-clean methods, but it will be more code.

-Dave

Index: boost/ref.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/ref.hpp,v
retrieving revision 1.17
diff -w -u -r1.17 ref.hpp
--- boost/ref.hpp 25 Aug 2002 11:56:32 -0000 1.17
+++ boost/ref.hpp 25 Feb 2003 00:47:14 -0000
@@ -7,6 +7,7 @@
 
 # include <boost/config.hpp>
 # include <boost/utility/addressof.hpp>
+# include <boost/mpl/bool_c.hpp>
 
 //
 // ref.hpp - ref/cref, useful helper functions
@@ -73,16 +74,14 @@
 # ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
 template<typename T>
 class is_reference_wrapper
+ : public mpl::false_c
 {
- public:
- BOOST_STATIC_CONSTANT(bool, value = false);
 };
 
 template<typename T>
 class is_reference_wrapper<reference_wrapper<T> >
+ : public mpl::true_c
 {
- public:
- BOOST_STATIC_CONSTANT(bool, value = true);
 };
 
 template<typename T>
@@ -146,6 +145,8 @@
         bool, value = (
             sizeof(detail::is_reference_wrapper_test(type<T>()))
             == sizeof(detail::yes_reference_wrapper_t)));
+
+ typedef ::boost::mpl::bool_c<value> type;
 };
 
 template <typename T>

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk