$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r53651 - in trunk: boost/lambda/detail libs/lambda/test
From: steven_at_[hidden]
Date: 2009-06-04 22:43:55
Author: steven_watanabe
Date: 2009-06-04 22:43:54 EDT (Thu, 04 Jun 2009)
New Revision: 53651
URL: http://svn.boost.org/trac/boost/changeset/53651
Log:
Don't propagate constness from pointer to pointee.  Fixes #1572
Text files modified: 
   trunk/boost/lambda/detail/operator_return_type_traits.hpp |    28 +++-------------------------            
   trunk/libs/lambda/test/operator_tests_simple.cpp          |    12 ++++++++++++                            
   2 files changed, 15 insertions(+), 25 deletions(-)
Modified: trunk/boost/lambda/detail/operator_return_type_traits.hpp
==============================================================================
--- trunk/boost/lambda/detail/operator_return_type_traits.hpp	(original)
+++ trunk/boost/lambda/detail/operator_return_type_traits.hpp	2009-06-04 22:43:54 EDT (Thu, 04 Jun 2009)
@@ -225,37 +225,15 @@
 
 
 template <class A> struct contentsof_type<const A> {
-  typedef typename contentsof_type<A>::type type1;
-  // return a reference to the underlying const type
-  // the IF is because the A::reference in the primary template could
-  // be some class type rather than a real reference, hence
-  // we do not want to make it a reference here either
-  typedef typename boost::remove_reference<type1>::type no_reference;
-  typedef typename detail::IF<
-      is_reference<type1>::value, 
-      const no_reference &,
-      const no_reference
-  >::RET type;
+  typedef typename contentsof_type<A>::type type;
 };
 
 template <class A> struct contentsof_type<volatile A> {
-  typedef typename contentsof_type<A>::type type1;
-  typedef typename boost::remove_reference<type1>::type no_reference;
-  typedef typename detail::IF<
-    is_reference<type1>::value, 
-    volatile no_reference &,
-    volatile no_reference
-  >::RET type;
+  typedef typename contentsof_type<A>::type type;
 };
 
 template <class A> struct contentsof_type<const volatile A> {
-  typedef typename contentsof_type<A>::type type1;
-  typedef typename boost::remove_reference<type1>::type no_reference;
-  typedef typename detail::IF<
-    is_reference<type1>::value, 
-    const volatile no_reference &,
-    const volatile no_reference
-  >::RET type;
+  typedef typename contentsof_type<A>::type type;
 };
 
   // standard iterator traits should take care of the pointer types 
Modified: trunk/libs/lambda/test/operator_tests_simple.cpp
==============================================================================
--- trunk/libs/lambda/test/operator_tests_simple.cpp	(original)
+++ trunk/libs/lambda/test/operator_tests_simple.cpp	2009-06-04 22:43:54 EDT (Thu, 04 Jun 2009)
@@ -19,6 +19,8 @@
 
 #include "boost/lambda/detail/suppress_unused.hpp"
 
+#include <boost/shared_ptr.hpp>
+
 #include <vector>
 #include <map>
 #include <set>
@@ -323,8 +325,18 @@
   
   (*_1 = 7)(it);
   BOOST_CHECK(vi[0] == 7); 
+  const std::vector<int>::iterator cit(it);
+  (*_1 = 8)(cit);
+  BOOST_CHECK(vi[0] == 8);
 
   // TODO: Add tests for more complex iterator types
+
+  boost::shared_ptr<int> ptr(new int(0));
+  (*_1 = 7)(ptr);
+  BOOST_CHECK(*ptr == 7);
+  const boost::shared_ptr<int> cptr(ptr);
+  (*_1 = 8)(cptr);
+  BOOST_CHECK(*ptr == 8);
 }