$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r59912 - in sandbox/statistics/detail/assign: boost/assign/auto_size boost/assign/auto_size/detail libs/assign/example
From: erwann.rogard_at_[hidden]
Date: 2010-02-25 15:08:05
Author: e_r
Date: 2010-02-25 15:08:04 EST (Thu, 25 Feb 2010)
New Revision: 59912
URL: http://svn.boost.org/trac/boost/changeset/59912
Log:
m
Text files modified: 
   sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp   |    19 +++++++                                 
   sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp |     6 +-                                      
   sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp         |    94 +++++++++++++-------------------------- 
   3 files changed, 51 insertions(+), 68 deletions(-)
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/detail/auto_size.hpp	2010-02-25 15:08:04 EST (Thu, 25 Feb 2010)
@@ -109,7 +109,7 @@
             );
         }
                 
-        // ---- as container ---- //
+        // ---- boost::array interface ---- //
                 
         typedef ref_ value_type;
         typedef typename boost::range_iterator<ref_array_>::type iterator;
@@ -146,9 +146,24 @@
             return !(this->size());
         }
                 
+		typedef typename ref_array_::reference reference;
+		typedef typename ref_array_::const_reference const_reference;
+
+		reference operator[](size_type i){ return (this->ref_array())[i]; }
+		const_reference operator[](size_type i)const{ 
+        	return (this->array())[i]; }
+
+		reference front(){ return (this->ref_array()).front(); }
+		const_reference front() const{ return (this->ref_array()).front(); }
+		reference back(){ return (this->ref_array()).back(); }
+		const_reference back() const{ return (this->ref_array()).back(); }
+        
+  		void swap(ref_array_& other){ return (this->ref_array()).swap(other); }
+  		void assign(const T& val){ return (this->ref_array()).assign(val); }
+        
         mutable previous_ previous;
         mutable ref_ ref;
-        
+
         private:
 
         void alloc()const{ 
Modified: sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp
==============================================================================
--- sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp	(original)
+++ sandbox/statistics/detail/assign/boost/assign/auto_size/ref_rebind_list_of.hpp	2010-02-25 15:08:04 EST (Thu, 25 Feb 2010)
@@ -13,9 +13,9 @@
 // This function supersedes ref_list_of<int>() as it deduces the number of 
 // elements, from the arguments. The infix 'rebind' emphasizes that if the 
 // result is the lhs of an assignement such as,
-// 	boost::fill(ref_rebind_list_of(a)(b)(c),d)
-// the elements, a, b and c, are bound to d. Unless this specific feature 
-// is required, it is more straightforward to use ref_list_of().
+// 	ref_rebind_list_of(a)(b)(c).assign(d)
+// binds a, b and c to d. Unless this specific feature is required, it is more 
+// straightforward to use ref_list_of().
 
 namespace boost{
 namespace assign{
Modified: sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp
==============================================================================
--- sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp	(original)
+++ sandbox/statistics/detail/assign/libs/assign/example/cref_list_of2.cpp	2010-02-25 15:08:04 EST (Thu, 25 Feb 2010)
@@ -38,92 +38,60 @@
     
           typedef std::vector<int> ints_;
     typedef boost::array<int,3> array_;
-	array_ array0 = {{-1,-1,-1}};
-	array_ array = array0;
+	array_ array;
+
+	// Since operator= calls begin(), end(), no need to test these separately
 
         {    
-    	int a=1,b=2,c=3;
+		// cref_list_of
+
+    	int a=1, b=2, c=3;
             ints_ ints;
     
-    	// cref_list_of<int>
-    	ints = cref_list_of<3>(a)(b)(3);
-		BOOST_ASSERT(ints[0] == a);    
-		BOOST_ASSERT(ints[1] == b);    
-		BOOST_ASSERT(ints[2] == 3);    
-        
-        array = array0;
-		array = cref_list_of<3>(a)(b)(3);
-		BOOST_ASSERT(array[0] == a);    
-		BOOST_ASSERT(array[1] == b);    
-		BOOST_ASSERT(array[2] == c);    
-        
-		// cref_copy_list_of
-    	ints.clear();
-		ints = cref_list_of(a)(b)(3);     
-		BOOST_ASSERT(ints[0] == a);    
-		BOOST_ASSERT(ints[1] == b);    
-		BOOST_ASSERT(ints[2] == c);    
-        array = array0;
-		array = cref_list_of(a)(b)(3);
-		BOOST_ASSERT(array[0] == a);    
-		BOOST_ASSERT(array[1] == b);    
-		BOOST_ASSERT(array[2] == c);    
-		{
+        {
                     ints.clear();
-        	BOOST_AUTO(
-        		tmp,
-            	cref_list_of(a)(b)(3)
-        	);
-        	ints = ints_(boost::begin(tmp),boost::end(tmp));
+			ints = cref_list_of(a)(b)(3);     
                         BOOST_ASSERT(ints[0] == a);    
                         BOOST_ASSERT(ints[1] == b);    
                         BOOST_ASSERT(ints[2] == c);    
-		}
-
-        // ref_list_of
+        }
+        {
+        	array.assign(-1);
+			array = cref_list_of(a)(b)(3);
+			BOOST_ASSERT(array[0] == a);    
+			BOOST_ASSERT(array[1] == b);    
+			BOOST_ASSERT(array[2] == c);    
+        }
+        {
+            BOOST_AUTO(tmp,ref_list_of(a)(b)(c));
+			std::fill(boost::begin(tmp),boost::end(tmp),0);
+			BOOST_ASSERT(a == 0);    
+			BOOST_ASSERT(b == 0);    
+			BOOST_ASSERT(c == 0);    
+        }
+	}
+    {
+        // ref_rebind_list_of
                 {
             int a=1, b=2, c=3;
+    		ints_ ints;
                     ints.clear();
-        	BOOST_AUTO(
-                tmp,
-                cref_rebind_list_of(a)(b)(c)
-            );
+        	BOOST_AUTO(tmp,cref_rebind_list_of(a)(b)(c));
             {
                         ints = tmp; 
                                 BOOST_ASSERT(ints[0] == a);    
                                 BOOST_ASSERT(ints[1] == b);    
                                 BOOST_ASSERT(ints[2] == c);    
             }
+            int d = 4;             
+            tmp.assign(d);
+			d = 5;
             {
-        		ints = ints_(boost::begin(tmp),boost::end(tmp));
-				BOOST_ASSERT(ints[0] == a);    
-				BOOST_ASSERT(ints[1] == b);    
-				BOOST_ASSERT(ints[2] == c);    
-            }
-            int d = 4;
-            std::fill(boost::begin(tmp),boost::end(tmp),d);
-            d = 5;
-            // Prints 4, 4, 4 instead of 5, 5, 5. However, works with Foo.
-            std::copy(
-            	boost::begin(tmp),
-                boost::end(tmp), 
-                std::ostream_iterator<int>(os, "\n")
-            );    
-/*
-            {
-        		ints = ints_(boost::begin(tmp),boost::end(tmp));
-				BOOST_ASSERT(ints[0] == d);    
-				BOOST_ASSERT(ints[1] == d);    
-				BOOST_ASSERT(ints[2] == d);    
-            }
-            {
-            	// Before rev. Feb 9, 2010,  this required a,b,c, respectively
                         ints = tmp;
                                 BOOST_ASSERT(ints[0] == d);    
                                 BOOST_ASSERT(ints[1] == d);    
                                 BOOST_ASSERT(ints[2] == d);    
             }
-*/
         }
         
     }