$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r69754 - in sandbox/assign_v2/libs/assign/v2/test: put utility
From: erwann.rogard_at_[hidden]
Date: 2011-03-08 22:30:12
Author: e_r
Date: 2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
New Revision: 69754
URL: http://svn.boost.org/trac/boost/changeset/69754
Log:
upd assign_v2
Added:
   sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/put/fun.h   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp   (contents, props changed)
   sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h   (contents, props changed)
Removed:
   sandbox/assign_v2/libs/assign/v2/test/utility/convert.cpp
   sandbox/assign_v2/libs/assign/v2/test/utility/convert.h
Added: sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/fun.cpp	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
@@ -0,0 +1,91 @@
+//////////////////////////////////////////////////////////////////////////////
+//  Boost.Assign v2                                                         //
+//                                                                          //
+//  Copyright (C) 2003-2004 Thorsten Ottosen                                //
+//  Copyright (C) 2010 Erwann Rogard                                        //
+//  Use, modification and distribution are subject to the                   //
+//  Boost Software License, Version 1.0. (See accompanying file             //
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)        //
+//////////////////////////////////////////////////////////////////////////////
+#include <vector>
+#include <deque>
+#include <boost/typeof/typeof.hpp>
+#include <boost/spirit/home/phoenix.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/put/container.hpp>
+#include <boost/assign/v2/put/deque.hpp>
+#include <boost/assign/v2/put/modulo/fun.hpp>
+#include <libs/assign/v2/test/put/fun.h>
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_fun{
+
+#ifdef __llvm__ 
+
+    struct f{
+        
+        typedef int result_type;
+        
+        template<typename T>
+        result_type operator()(T const& i)const{ return i + 1; };
+        
+    };
+    
+    void test()
+    {
+        namespace as2 = boost::assign::v2;
+        {
+            std::vector<int> incr_fact;
+            (
+             as2::put( cont ) % ( as2::_fun = f() )
+             )( 1 )( 2 )( 6 )( 24 )( 120 ); 
+            
+            BOOST_ASSIGN_V2_CHECK( incr_fact.front() == ( 2 ) );
+            BOOST_ASSIGN_V2_CHECK( incr_fact.back() == ( 121 ) );
+            // TODO fix Bug :
+            // LLVM 1.5 - Release mode, EXC_BAD_ACCESS, stl_vector.h #602
+        }        
+        
+    }
+    
+#else
+
+    void test()
+    {
+        namespace as2 = boost::assign::v2;
+        namespace lambda = boost::phoenix;
+        {
+            //[modulo_fun
+            std::vector<int> incr_fact;
+            (
+            	as2::put( incr_fact ) % ( as2::_fun = lambda::arg_names::arg1 + 1 )
+            )/*<<1!, 2!, 3!, 4!, 5!>>*/( 1 )( 2 )( 6 )( 24 )( 120 ); 
+
+            BOOST_ASSIGN_V2_CHECK( incr_fact.front() == ( 2 ) );
+            BOOST_ASSIGN_V2_CHECK( incr_fact.back() == ( 121 ) );
+            //]
+        }
+        {
+            //[modulo_fun_deque
+            BOOST_AUTO(
+                incr_fact, (
+                    as2::deque<int>( as2::_nil ) % (
+                        as2::_fun = ( lambda::arg_names::arg1 + 1 )
+                    )
+                )/*<<1!, 2!, 3!, 4!, 5!>>*/( 1 )( 2 )( 6 )( 24 )( 120 )
+            );
+
+            BOOST_ASSIGN_V2_CHECK( incr_fact.front() == ( 2 ) );
+            BOOST_ASSIGN_V2_CHECK( incr_fact.back() == ( 121 ) );
+            //]
+        }
+
+    }
+
+#endif
+
+
+}// xxx_fun
+}// xxx_put
+}// test_assign_v2
Added: sandbox/assign_v2/libs/assign/v2/test/put/fun.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/put/fun.h	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+//  Boost.Assign v2                                                         //
+//                                                                          //
+//  Copyright (C) 2003-2004 Thorsten Ottosen                                //
+//  Copyright (C) 2010 Erwann Rogard                                        //
+//  Use, modification and distribution are subject to the                   //
+//  Boost Software License, Version 1.0. (See accompanying file             //
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)        //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_PUT_FUN_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_PUT_FUN_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_put{
+namespace xxx_fun{
+
+    void test();
+
+}// xxx_fun
+}// xxx_put
+}// xxx_test_assign
+
+#endif
Added: sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/conversion.cpp	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
@@ -0,0 +1,123 @@
+//////////////////////////////////////////////////////////////////////////////
+//  Boost.Assign v2                                                         //
+//                                                                          //
+//  Copyright (C) 2003-2004 Thorsten Ottosen                                //
+//  Copyright (C) 2010 Erwann Rogard                                        //
+//  Use, modification and distribution are subject to the                   //
+//  Boost Software License, Version 1.0. (See accompanying file             //
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)        //
+//////////////////////////////////////////////////////////////////////////////
+#include <vector>
+#include <stack>
+#include <boost/array.hpp>
+#include <boost/assign/v2/detail/check/equal_container.hpp>
+#include <boost/assign/v2/detail/config/check.hpp>
+#include <boost/assign/v2/utility/conversion.hpp>
+#include <boost/assign/v2/utility/conversion/check.hpp>
+#include <boost/assign/v2/ref/array.hpp>
+#include <boost/assign/v2/put/deque.hpp>
+#include <libs/assign/v2/test/utility/conversion.h>
+
+
+namespace test_assign_v2{
+namespace xxx_utility{
+namespace xxx_conversion{
+
+    // suggested by JB:
+    //[convert_f
+    template<typename C, typename R>
+    void f(C cont, R const& r){
+        namespace as2 = boost::assign::v2;
+        as2::check_aux::equal_container( cont, r );
+    }
+	//]
+    
+    void test()
+    {
+        namespace as2 = boost::assign::v2;
+        namespace ns = as2::check_aux;
+
+        // Non-Boost.Assign.2.0 containers - fully qualified as2::converter()
+        {
+            //[convert_inpl
+            std::vector<int> v( 3 ); v[0] = 1; v[1] = 2; v[2] = 0;
+            typedef boost::array<int, 3> ar_;
+            BOOST_ASSIGN_V2_CHECK(
+                ( as2::converter( v ).type<ar_>() )[1] == v[1]
+            );
+            //]
+            BOOST_ASSIGN_V2_CHECK(
+                ( as2::converter( v ).type<ar_>() )[0] == v[0]
+            );
+            BOOST_ASSIGN_V2_CHECK(
+                ( as2::converter( v ).type<ar_>() )[2] == v[2]
+            );
+        }
+        {
+            //[convert_copy
+            std::vector<int> v( 3 ); v[0] = 72; v[1] = 31; v[2] = 48;
+            std::stack<int> lifo = as2::converter( v );
+            BOOST_ASSIGN_V2_CHECK( lifo.top() == 48 );
+            //]
+        }
+        {
+            {
+            	typedef int T;
+            	typedef std::vector<T> R; R r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48; 
+                typedef std::vector<T> C; f<C>( as2::converter( r ), r );
+            }
+            {
+            	typedef int T;
+            	typedef std::vector<T> R; R r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48; 
+                typedef std::deque<T> C; f<C>( as2::converter( r ), r );
+            }
+            {
+            	typedef int T;
+            	typedef std::vector<T> R; R r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48; 
+                typedef std::list<T> C; f<C>( as2::converter( r ), r );
+            }
+            {
+            	//[convert_f_invoke
+            	typedef int T;
+            	typedef std::vector<T> R; R r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48; 
+                typedef std::stack<T> C; f<C>( as2::converter( r ), r );
+                //]
+            }
+            {
+            	typedef int T;
+            	typedef std::vector<T> R; R r( 3 ); r[0] = 72; r[1] = 31; r[2] = 48; 
+                typedef std::queue<T> C; f<C>( as2::converter( r ), r );
+            }
+        }
+        
+        // Non-Boost.Assign.2.0 containers - name lookup
+        {
+            //[convert_array
+            std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::ref::array( 72 )( 31 )( 48 ) );
+            BOOST_ASSIGN_V2_CHECK( lifo.top() == 48 );
+            //]
+        }
+        {
+            //[convert_csv_array
+            std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::ref::csv_array( 72, 31, 48 ) );
+            BOOST_ASSIGN_V2_CHECK( lifo.top() == 48 );
+            //]
+        }
+        {
+            //[convert_deque
+            std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::deque<int>( 72 )( 31 )( 48 ) );
+            BOOST_ASSIGN_V2_CHECK( lifo.top() == 48 );
+            //]
+        }
+        {
+            //[convert_csv_array
+            std::stack<int> lifo = /*<<Notice unqualified (name lookup)>>*/converter( as2::csv_deque( 72, 31, 48 ) );
+            BOOST_ASSIGN_V2_CHECK( lifo.top() == 48 );
+            //]
+        }
+    }
+
+}// xxx_conversion
+}// xxx_utility
+}// xxx_test_assign
+
Added: sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h
==============================================================================
--- (empty file)
+++ sandbox/assign_v2/libs/assign/v2/test/utility/conversion.h	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
@@ -0,0 +1,23 @@
+//////////////////////////////////////////////////////////////////////////////
+//  Boost.Assign v2                                                         //
+//                                                                          //
+//  Copyright (C) 2003-2004 Thorsten Ottosen                                //
+//  Copyright (C) 2010 Erwann Rogard                                        //
+//  Use, modification and distribution are subject to the                   //
+//  Boost Software License, Version 1.0. (See accompanying file             //
+//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)        //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef LIBS_ASSIGN_V2_TEST_UTILITY_CONVERSION_ER_2010_H
+#define LIBS_ASSIGN_V2_TEST_UTILITY_CONVERSION_ER_2010_H
+
+namespace test_assign_v2{
+namespace xxx_utility{
+namespace xxx_conversion{
+
+    void test();
+
+}// xxx_conversion
+}// xxx_utility
+}// xxx_test_assign
+
+#endif
Deleted: sandbox/assign_v2/libs/assign/v2/test/utility/convert.cpp
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/convert.cpp	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
Deleted: sandbox/assign_v2/libs/assign/v2/test/utility/convert.h
==============================================================================
--- sandbox/assign_v2/libs/assign/v2/test/utility/convert.h	2011-03-08 22:30:11 EST (Tue, 08 Mar 2011)
+++ (empty file)
@@ -1 +0,0 @@
-// TODO remove file
\ No newline at end of file