$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r56151 - in sandbox/variadic_templates: . boost/mpl boost/mpl/list/aux_ boost/mpl/map/aux_ boost/mpl/vector/aux_ libs/mpl/test
From: cppljevans_at_[hidden]
Date: 2009-09-11 20:55:17
Author: cppljevans
Date: 2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
New Revision: 56151
URL: http://svn.boost.org/trac/boost/changeset/56151
Log:
* In several of sequence tests and headers:
  Rm'ed the:
    typedef SEQ type;
  For reason's outlined in the:
    //!@nv-mpl_diff:
  comments to:
    libs/mpl/test/list_c.cpp
    
* Created X_item_fold classes for X in {m,s,v,l}
  and made that a metafunction instead of just
  a template.
  
* Renamed foldr_pkg to foldr_pack
* Used foldr_pack with X_item_fold to define super
  of all sequences.
    
Added:
   sandbox/variadic_templates/Jamfile   (contents, props changed)
   sandbox/variadic_templates/boost/mpl/foldr_iter.hpp   (contents, props changed)
   sandbox/variadic_templates/boost/mpl/foldr_pack.hpp
      - copied, changed from r55955, /sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp
   sandbox/variadic_templates/boost/mpl/vector/aux_/begin_end.hpp   (contents, props changed)
   sandbox/variadic_templates/libs/mpl/test/foldr_pack.cpp   (contents, props changed)
   sandbox/variadic_templates/libs/mpl/test/for_each.cpp   (contents, props changed)
   sandbox/variadic_templates/libs/mpl/test/list_c.cpp   (contents, props changed)
   sandbox/variadic_templates/libs/mpl/test/set_c.cpp   (contents, props changed)
   sandbox/variadic_templates/libs/mpl/test/vector_c.cpp   (contents, props changed)
Removed:
   sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp
Text files modified: 
   sandbox/variadic_templates/boost/mpl/foldr_pack.hpp          |    36 +++++++++++++++-------------            
   sandbox/variadic_templates/boost/mpl/list.hpp                |    17 ++++++++-----                           
   sandbox/variadic_templates/boost/mpl/list/aux_/begin_end.hpp |     6 ++--                                    
   sandbox/variadic_templates/boost/mpl/list/aux_/item.hpp      |    26 +++++++++++++++++---                    
   sandbox/variadic_templates/boost/mpl/list/aux_/list0.hpp     |     2                                         
   sandbox/variadic_templates/boost/mpl/list_c.hpp              |     7 +++--                                   
   sandbox/variadic_templates/boost/mpl/map/aux_/clear_impl.hpp |     2                                         
   sandbox/variadic_templates/boost/mpl/reverse_fold.hpp        |     4 +-                                      
   sandbox/variadic_templates/boost/mpl/set.hpp                 |     7 ++---                                   
   sandbox/variadic_templates/boost/mpl/set_c.hpp               |     5 ++-                                     
   sandbox/variadic_templates/boost/mpl/vector.hpp              |     8 +++---                                  
   sandbox/variadic_templates/boost/mpl/vector/aux_/item.hpp    |     6 ++--                                    
   sandbox/variadic_templates/boost/mpl/vector_c.hpp            |     7 +++--                                   
   sandbox/variadic_templates/libs/mpl/test/Jamfile             |     2 +                                       
   sandbox/variadic_templates/libs/mpl/test/copy.cpp            |    21 ++++------------                        
   sandbox/variadic_templates/libs/mpl/test/copy_if.cpp         |    50 +++++++++++++++++++++++++++++---------- 
   sandbox/variadic_templates/libs/mpl/test/map.cpp             |    23 ++++++++++++++----                      
   17 files changed, 142 insertions(+), 87 deletions(-)
Added: sandbox/variadic_templates/Jamfile
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/Jamfile	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,6 @@
+project boost
+    : requirements 
+      <include>.
+    : usage-requirements 
+      <include>.
+    ;
Added: sandbox/variadic_templates/boost/mpl/foldr_iter.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/mpl/foldr_iter.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,68 @@
+#ifndef BOOST_MPL_FOLDR_ITER_HPP_VARIADIC_TEMPLATES
+#define BOOST_MPL_FOLDR_ITER_HPP_VARIADIC_TEMPLATES
+#include <boost/mpl/next.hpp>
+#include <boost/mpl/if_recur.hpp>
+#include <boost/mpl/aux_/if_recur_fold.hpp>
+namespace boost { namespace mpl {
+
+  template
+  < typename IterNow //start ValueIterator.
+  , typename IterEnd //end ValueIterator.
+  , typename State0 //initial State
+  , typename OpIterState //Operator: (ValueIterator,State) -> State
+  >
+  struct
+foldr_iter
+/**@brief
+ *  Same as foldl_iter except association is to the right,
+ *  and Operator arguments are swapped.
+ *  IOW, the analogue result (see comments to foldl_iter.hpp) is:
+ *    F(x1,F(x2,F(x3,z)))
+ *
+ *  This template is similar to the haskell foldr described on p. 117 of:
+ *
+ *    http://haskell.org/definition/haskell98-report.pdf
+ *
+ *  where:
+ *     haskell these_comments
+ *     ------- --------------
+ *     f       F
+ *     a       Value
+ *     b       State
+ *     z       initial State
+ */
+: apply
+  < OpIterState
+  , IterNow
+  , typename foldr_iter
+    < typename next<IterNow>::type
+    , IterEnd
+    , State0
+    , OpIterState
+    >::type
+  >
+{  
+};
+
+  template
+  < typename IterEnd
+  , typename State0
+  , typename OpIterState
+  >
+  struct
+foldr_iter
+  < IterEnd
+  , IterEnd
+  , State0
+  , OpIterState
+  >
+{
+        typedef
+      State0
+    type
+    ;    
+};
+
+}}//exit boost::mpl namespace
+
+#endif //include guard
Copied: sandbox/variadic_templates/boost/mpl/foldr_pack.hpp (from r55955, /sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp)
==============================================================================
--- /sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/foldr_pack.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -1,16 +1,15 @@
-#ifndef BOOST_MPL_FOLDR_PKG_HPP_VARIADIC_TEMPLATES
-#define BOOST_MPL_FOLDR_PKG_HPP_VARIADIC_TEMPLATES
-#include <boost/mpl/apply.hpp>
+#ifndef BOOST_MPL_FOLDR_PACK_HPP_VARIADIC_TEMPLATES
+#define BOOST_MPL_FOLDR_PACK_HPP_VARIADIC_TEMPLATES
 
 namespace boost { namespace mpl {
 
   template
   < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
+  , template<typename Value,typename State>class OpValueState_State //Operator: (Value,State) -> State
   , typename... Values
   >
   struct
-foldr_pkg
+foldr_pack
 /**@brief
  *  Apply OpValueState_State to each element in Values...
  *  starting with intial State, State0.  Associate the applications
@@ -40,38 +39,41 @@
 ;
   template
   < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
+  , template<typename Value,typename State>class OpValueState_State
   , typename Head
   , typename... Tail
   >
   struct
-foldr_pkg
+foldr_pack
   < State0
   , OpValueState_State
   , Head
   , Tail...
   >
-: apply
-  < OpValueState_State
-  , Head
-  , typename foldr_pkg
+: OpValueState_State
+  < Head
+  , typename foldr_pack
     < State0
     , OpValueState_State
     , Tail...
     >::type
-  >::type
-{};
+  >
+{
+};
   template
-  < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
+  < typename State0
+  , template<typename Value,typename State>class OpValueState_State
   >
   struct
-foldr_pkg
+foldr_pack
   < State0
   , OpValueState_State
   >
 {
-    typedef State0 type;
+        typedef 
+      State0 
+    type
+    ;
 };
 
 }}//exit boost::mpl namespace
Deleted: sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/foldr_pkg.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
+++ (empty file)
@@ -1,79 +0,0 @@
-#ifndef BOOST_MPL_FOLDR_PKG_HPP_VARIADIC_TEMPLATES
-#define BOOST_MPL_FOLDR_PKG_HPP_VARIADIC_TEMPLATES
-#include <boost/mpl/apply.hpp>
-
-namespace boost { namespace mpl {
-
-  template
-  < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
-  , typename... Values
-  >
-  struct
-foldr_pkg
-/**@brief
- *  Apply OpValueState_State to each element in Values...
- *  starting with intial State, State0.  Associate the applications
- *  to the right.
- *
- *  For example, the analogous operation on run-time-value's is:
- *
- *    Assuming:
- *       z == the run-time-value analogue of State0.
- *       xI == the analogue of I-th element in Values...
- *       F == the analogue of OpValueState_State.
- *    Then the analogue of result would be:
- *      F(x1,F(x2,F(x3,z)))
- *
- *  This template is similar to the haskell foldr described on p. 117 of:
- *
- *    http://haskell.org/definition/haskell98-report.pdf
- *
- *  where:
- *     haskell these_comments
- *     ------- --------------
- *     f       F
- *     a       typename
- *     b       State
- *     z       initial State
- */
-;
-  template
-  < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
-  , typename Head
-  , typename... Tail
-  >
-  struct
-foldr_pkg
-  < State0
-  , OpValueState_State
-  , Head
-  , Tail...
-  >
-: apply
-  < OpValueState_State
-  , Head
-  , typename foldr_pkg
-    < State0
-    , OpValueState_State
-    , Tail...
-    >::type
-  >::type
-{};
-  template
-  < typename State0 //initial State
-  , typename OpValueState_State //Operator: (Value,State) -> State
-  >
-  struct
-foldr_pkg
-  < State0
-  , OpValueState_State
-  >
-{
-    typedef State0 type;
-};
-
-}}//exit boost::mpl namespace
-
-#endif //include guard
Modified: sandbox/variadic_templates/boost/mpl/list.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/list.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/list.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -1,8 +1,7 @@
 #ifndef BOOST_MPL_LIST_HPP_INCLUDED
 #define BOOST_MPL_LIST_HPP_INCLUDED
 #include <boost/mpl/list/list0.hpp>
-#include <boost/mpl/foldr_pkg.hpp>
-#include <boost/mpl/quote.hpp>
+#include <boost/mpl/foldr_pack.hpp>
 
 namespace boost
 {
@@ -14,19 +13,23 @@
   >
   struct
 list
-  : foldr_pkg
-    < list0
-    , quote2<l_item>
-    , Values...
-    >::type
 //@diff-nv-mpl:
 //  This specialization corresponds to all of the listI
 //  for I=1..., which are defined in non-variadic mpl in 
 //  one of the files:
 //    boost/mpl/list/aux_/preprocessed/plain/listN.hpp
 //  for some N in 10,20,...
+  : foldr_pack
+    < list0
+    , l_item_fold
+    , Values...
+    >::type
 {
+  #ifdef TYPEDEF_SEQ_TYPE
+    typedef list type;
+  #endif
 };
+
   
 
 }//exit mpl namespace
Modified: sandbox/variadic_templates/boost/mpl/list/aux_/begin_end.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/list/aux_/begin_end.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/list/aux_/begin_end.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -11,8 +11,8 @@
 // See http://www.boost.org/libs/mpl for documentation.
 
 // $Id$
-// $Date: 2009/08/30 04:12:38 $
-// $Revision: 1.3 $
+// $Date: 2009/09/02 16:17:55 $
+// $Revision: 1.5 $
 
 #include <boost/mpl/begin_end_fwd.hpp>
 #include <boost/mpl/list/aux_/iterator.hpp>
@@ -26,7 +26,7 @@
 {
     template< typename List > struct apply
     {
-        typedef l_iter<typename List::pkg_type> type;
+        typedef l_iter<typename List::type> type;
     };
 };
 
Modified: sandbox/variadic_templates/boost/mpl/list/aux_/item.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/list/aux_/item.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/list/aux_/item.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -11,8 +11,8 @@
 // See http://www.boost.org/libs/mpl for documentation.
 
 // $Id$
-// $Date: 2009/08/30 14:45:16 $
-// $Revision: 1.7 $
+// $Date: 2009/09/01 19:28:35 $
+// $Revision: 1.10 $
 
 #include <boost/mpl/list/aux_/tag.hpp>
 #include <boost/mpl/aux_/config/msvc.hpp>
@@ -25,20 +25,38 @@
     , typename Next
     >
 struct l_item
+  : Next
+//!  
+//!@diff-nv-mpl:
+//!  WHAT:
+//!    Inherits from Next.
+//!  WHY:
+//!    Elimiates need to typedef tag (inherited from last Next)
+//!    and, in the case of list_c, the need to typedef value_type
+//!    (since it's also inherited from last Next, which, in the
+//!    case of list_c, would be list0_c.
+//!
 {
 // agurt, 17/jul/03: to facilitate the deficient 'is_sequence' implementation 
 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
     typedef int begin;
 #endif
-    typedef aux::list_tag tag;
     typedef l_item type;
-    typedef l_item pkg_type;
 
     typedef typename next<typename Next::size>::type size;
     typedef T item;
     typedef Next next;
 };
 
+template<
+      typename T
+    , typename Next
+    >
+struct l_item_fold
+{
+    typedef l_item<T,Next> type;
+};
+
 }}
 
 #endif // BOOST_MPL_LIST_AUX_NODE_HPP_INCLUDED
Modified: sandbox/variadic_templates/boost/mpl/list/aux_/list0.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/list/aux_/list0.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/list/aux_/list0.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -27,7 +27,7 @@
 #endif
     typedef aux::list_tag tag;
     typedef list0 type;
-    typedef list0 pkg_type;
+//    typedef type end_type;
     
     typedef long_<0> size;
 };
Modified: sandbox/variadic_templates/boost/mpl/list_c.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/list_c.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/list_c.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -9,14 +9,15 @@
 {
   template
   < typename Integral
-  , Integral... Args
+  , Integral... Values
   >
   struct
 list_c
-: list<integral_c<Integral,Args>...>
+  : list
+    < integral_c<Integral,Values>...
+    >
 {
     typedef Integral value_type;
-    typedef list_c type;
 };
 
 }//exit mpl namespace
Modified: sandbox/variadic_templates/boost/mpl/map/aux_/clear_impl.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/map/aux_/clear_impl.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/map/aux_/clear_impl.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -26,7 +26,7 @@
 {
     template< typename Map > struct apply
     {
-        typedef map<> type;
+        typedef map0 type;
     };
 };
 
Modified: sandbox/variadic_templates/boost/mpl/reverse_fold.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/reverse_fold.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/reverse_fold.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -1,6 +1,6 @@
 #ifndef BOOST_MPL_REVERSE_FOLD_HPP_VARIADIC_TEMPLATES
 #define BOOST_MPL_REVERSE_FOLD_HPP_VARIADIC_TEMPLATES
-#include <boost/mpl/foldr_iter_if.hpp>
+#include <boost/mpl/foldr_iter.hpp>
 #include <boost/mpl/begin_end.hpp>
 #include <boost/mpl/deref.hpp>
 #include <boost/mpl/lambda.hpp>
@@ -16,7 +16,7 @@
 reverse_fold
 {
         typedef
-      typename foldr_iter_if
+      typename foldr_iter
       < typename begin<Sequence>::type
       , typename end<Sequence>::type
       , State
Modified: sandbox/variadic_templates/boost/mpl/set.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/set.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/set.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -16,8 +16,7 @@
 
 #include <boost/mpl/aux_/value_wknd.hpp>
 #include <boost/mpl/set/set0.hpp>
-#include <boost/mpl/foldr_pkg.hpp>
-#include <boost/mpl/quote.hpp>
+#include <boost/mpl/foldr_pack.hpp>
 
 namespace boost
 {
@@ -29,9 +28,9 @@
   >
   struct
 set
-  : foldr_pkg
+  : foldr_pack
     < set0
-    , s_item<arg<1>,arg<2> >
+    , s_item_fold
     , Values...
     >::type
 //!
Modified: sandbox/variadic_templates/boost/mpl/set_c.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/set_c.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/set_c.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -13,10 +13,11 @@
   >
   struct
 set_c
-  : set<integral_c<Integral,Args>...>
+  : set
+    < integral_c<Integral,Args>...
+    >
 {
     typedef Integral value_type;
-    typedef set_c type;
 };
 
 }//exit mpl namespace
Modified: sandbox/variadic_templates/boost/mpl/vector.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/vector.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/vector.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -7,7 +7,7 @@
 //!  indirectly #includes vector_fwd.hpp.
 //!
 #include <boost/mpl/vector/vector0.hpp>
-#include <boost/mpl/foldr_pkg.hpp>
+#include <boost/mpl/foldr_pack.hpp>
 
 namespace boost
 {
@@ -19,9 +19,9 @@
   >
   struct
 vector
-  : foldr_pkg
+  : foldr_pack
     < vector0
-    , v_item_fold<arg<1>,arg<2> >
+    , v_item_fold
     , Values...
     >::type
 //!
@@ -36,7 +36,7 @@
 //!  WHAT:
 //!    1) Instead of adding items from the tail, items are added from
 //!       head.
-//!    2) foldr_pkg is used instead of recursive call of vector.
+//!    2) foldr_pack is used instead of recursive call of vector.
 //!  WHY:
 //!    1) The variadic template compiler doesn't allow parameter
 //!       packs to be followed by anything else (designated here as the
Added: sandbox/variadic_templates/boost/mpl/vector/aux_/begin_end.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/mpl/vector/aux_/begin_end.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,49 @@
+
+#ifndef BOOST_MPL_VECTOR_AUX_BEGIN_END_HPP_INCLUDED
+#define BOOST_MPL_VECTOR_AUX_BEGIN_END_HPP_INCLUDED
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/09/08 19:38:37 $
+// $Revision: 1.1 $
+
+#include <boost/mpl/aux_/config/typeof.hpp>
+
+#if defined(BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES)
+
+#   include <boost/mpl/begin_end_fwd.hpp>
+#   include <boost/mpl/vector/aux_/iterator.hpp>
+#   include <boost/mpl/vector/aux_/tag.hpp>
+
+namespace boost { namespace mpl {
+
+template<>
+struct begin_impl< aux::vector_tag >
+{
+    template< typename Vector > struct apply
+    {
+        typedef v_iter<typename Vector::type,0> type;
+    };
+};
+
+template<>
+struct end_impl< aux::vector_tag >
+{
+    template< typename Vector > struct apply
+    {
+        typedef v_iter<typename Vector::type,Vector::size::value> type;
+    };
+};
+
+}}
+
+#endif // BOOST_MPL_CFG_TYPEOF_BASED_SEQUENCES
+
+#endif // BOOST_MPL_VECTOR_AUX_BEGIN_END_HPP_INCLUDED
Modified: sandbox/variadic_templates/boost/mpl/vector/aux_/item.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/vector/aux_/item.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/vector/aux_/item.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -11,8 +11,8 @@
 // See http://www.boost.org/libs/mpl for documentation.
 
 // $Id$
-// $Date: 2009/03/27 20:36:14 $
-// $Revision: 1.3 $
+// $Date: 2009/09/07 04:00:08 $
+// $Revision: 1.5 $
 
 #include <boost/mpl/long.hpp>
 #include <boost/mpl/void.hpp>
@@ -89,8 +89,8 @@
     , typename Base
     >
 struct v_item_fold
-    : v_item<T,Base,1>
 {
+    typedef v_item<T,Base,1> type;
 };
 
 // "erasure" item
Modified: sandbox/variadic_templates/boost/mpl/vector_c.hpp
==============================================================================
--- sandbox/variadic_templates/boost/mpl/vector_c.hpp	(original)
+++ sandbox/variadic_templates/boost/mpl/vector_c.hpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -9,14 +9,15 @@
 {
   template
   < typename Integral
-  , Integral... Args
+  , Integral... Values
   >
   struct
 vector_c
-  : vector<integral_c<Integral,Args>...>
+  : vector
+    < integral_c<Integral,Values>...
+    >
 {
     typedef Integral value_type;
-    typedef vector_c type;
 };
 
 }//exit mpl namespace
Modified: sandbox/variadic_templates/libs/mpl/test/Jamfile
==============================================================================
--- sandbox/variadic_templates/libs/mpl/test/Jamfile	(original)
+++ sandbox/variadic_templates/libs/mpl/test/Jamfile	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -34,6 +34,7 @@
  compile find.cpp ;
  compile find_if.cpp ;
  compile fold.cpp ;
+ compile foldr_pack.cpp ;
  run for_each.cpp ;
 
  compile front.cpp ;
@@ -46,6 +47,7 @@
  compile insert.cpp ;
  compile insert_range.cpp ;
  run int.cpp ;
+ compile int.cpp : : int.compile ;
  run integral_c.cpp : : : <toolset>vacpp:<cxxflags>-qchars=signed ;
  compile is_placeholder.cpp ;
  compile is_sequence.cpp ;
Modified: sandbox/variadic_templates/libs/mpl/test/copy.cpp
==============================================================================
--- sandbox/variadic_templates/libs/mpl/test/copy.cpp	(original)
+++ sandbox/variadic_templates/libs/mpl/test/copy.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -9,17 +9,12 @@
 // See http://www.boost.org/libs/mpl for documentation.
 
 // $Id$
-// $Date: 2009/05/26 21:10:09 $
-// $Revision: 1.5 $
+// $Date: 2009/09/04 02:54:46 $
+// $Revision: 1.7 $
 
-#define USE_RANGE_C
-#ifdef USE_RANGE_C
-  #include <boost/mpl/range_c.hpp>
-#else
-  //disallow using range_c because currently 
-  //(gcc-4.4-20090109) compiler buggy.
-#endif  
+#include <boost/mpl/range_c.hpp>
 #include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/vector.hpp>
 #include <boost/mpl/copy.hpp>
 #include <boost/mpl/front_inserter.hpp>
 #include <boost/mpl/size.hpp>
@@ -30,18 +25,14 @@
 {
     typedef vector_c<int,9,8,7,6,5,4,3,2,1,0> answer;
     typedef copy<
-      #ifdef USE_RANGE_C
           range_c<int,0,10>
-      #else
-          vector_c<int,0,1,2,3,4,5,6,7,8,9>
-      #endif
         , mpl::front_inserter< vector<> >
         >::type result;
 
     MPL_ASSERT_RELATION( size<result>::value, ==, 10 );
     MPL_ASSERT(( equal< result,answer > ));
 }
-#ifdef USE_RANGE_C
+
 MPL_TEST_CASE()
 {
     typedef vector_c<int,10,11,12,13,14,15,16,17,18,19> numbers;
@@ -53,4 +44,4 @@
     MPL_ASSERT_RELATION( size<result>::value, ==,  20 );
     MPL_ASSERT(( equal< result,range_c<int,0,20> > ));
 }
-#endif
+
Modified: sandbox/variadic_templates/libs/mpl/test/copy_if.cpp
==============================================================================
--- sandbox/variadic_templates/libs/mpl/test/copy_if.cpp	(original)
+++ sandbox/variadic_templates/libs/mpl/test/copy_if.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -9,10 +9,11 @@
 // See http://www.boost.org/libs/mpl for documentation.
 
 // $Id$
-// $Date: 2009/08/23 20:20:38 $
-// $Revision: 1.5 $
+// $Date: 2009/09/10 21:59:42 $
+// $Revision: 1.10 $
 
 #include <boost/mpl/copy_if.hpp>
+#include <boost/mpl/list.hpp>
 #include <boost/mpl/list_c.hpp>
 #include <boost/mpl/front_inserter.hpp>
 #include <boost/mpl/less.hpp>
@@ -30,26 +31,49 @@
     typedef copy_if<
           numbers
         , less<_,int_<5> >
-        , mpl::front_inserter< list_c<int> >
+        , mpl::front_inserter
+          < list<> 
+          >
         >::type result;
 
     MPL_ASSERT_RELATION(size<result>::value, ==, 5);
-//    MPL_ASSERT(( is_same<void,begin<answer>::type> ));
- //   MPL_ASSERT(( is_same<void,begin<result>::type> ));
     MPL_ASSERT(( equal<result,answer> ));
+
 }
 
 
 MPL_TEST_CASE()
 {
-    typedef list<int,float,long,float,char,long,double,double>::type types;
-    typedef list<float,float,double,double>::type float_types;
-    typedef reverse_copy_if<
-          types
-        , is_float<_>
-        , mpl::front_inserter< list<> >
-        >::type result;
+        typedef 
+      list
+      < int
+      , float
+      , long
+      , float
+      , char
+      , long
+      , double
+      , double
+      >::type 
+    types;
+        typedef 
+      list
+      < float
+      , float
+      , double
+      , double
+      >::type 
+    answer;
+        typedef 
+      reverse_copy_if
+      < types
+      , is_float<_>
+      , mpl::front_inserter
+        < list<> 
+        >
+      >::type 
+    result;
 
     MPL_ASSERT_RELATION(mpl::size<result>::value, ==, 4);
-    MPL_ASSERT(( equal<result,float_types> ));
+    MPL_ASSERT(( equal<result,answer> ));
 }
Added: sandbox/variadic_templates/libs/mpl/test/foldr_pack.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/mpl/test/foldr_pack.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,26 @@
+
+// Copyright Larry Evans 2009
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/08/29 21:19:01 $
+// $Revision: 1.1 $
+
+#include <boost/mpl/foldr_pack.hpp>
+#include <boost/mpl/pair.hpp>
+#include <boost/mpl/arg.hpp>
+#include <boost/type_traits/is_same.hpp>
+
+#include <boost/mpl/aux_/test.hpp>
+
+MPL_TEST_CASE()
+{
+    typedef foldr_pack<int,pair,float,char>::type result;
+    typedef pair<float,pair<char,int> > answer;
+    MPL_ASSERT(( is_same<answer,result> ));
+}
Added: sandbox/variadic_templates/libs/mpl/test/for_each.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/mpl/test/for_each.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,91 @@
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/09/11 14:48:54 $
+// $Revision: 1.2 $
+
+#include <boost/mpl/for_each.hpp>
+
+#include <boost/mpl/list.hpp>
+#include <boost/mpl/range_c.hpp>
+#include <boost/mpl/identity.hpp>
+#include <boost/mpl/lambda.hpp>
+#include <boost/bind.hpp>
+
+#include <vector>
+#include <iostream>
+#include <algorithm>
+#include <typeinfo>
+#include <cassert>
+
+namespace mpl = boost::mpl;
+
+struct type_printer
+{
+    type_printer(std::ostream& s) : f_stream(&s) {}
+    template< typename U > void operator()(mpl::identity<U>)
+    {
+        *f_stream << typeid(U).name() << '\n';
+    }
+
+ private:
+    std::ostream* f_stream;
+};
+
+struct value_printer
+{
+    value_printer(std::ostream& s) : f_stream(&s) {}
+    template< typename U > void operator()(U x)
+    {
+        *f_stream << x << '\n';
+    }
+
+ private:
+    std::ostream* f_stream;
+};
+
+#ifdef __ICL
+# pragma warning(disable:985)
+#endif
+
+int main()
+{
+    typedef mpl::list<char,short,int,long,float,double> types;
+    mpl::for_each< types,mpl::make_identity<mpl::_1> >(type_printer(std::cout));
+
+    typedef mpl::range_c<int,0,10> numbers;
+    std::vector<int> v;
+
+//!@nv-mpl_diff:
+//!  WHAT:
+//!    Added test for defined(__GXX_EXPERIMENTAL_CXX0X__)
+//!  WHY:
+//!    The bug in variadic g++ reported here:
+//!
+//!      http://listarchives.boost.org/Archives/boost/2009/09/155922.php
+//!
+#if defined(__SGI_STL_PORT) || defined(__GXX_EXPERIMENTAL_CXX0X__)
+    void (std::vector<int>::* push_back)(int const&) = &std::vector<int>::push_back;
+    mpl::for_each<numbers>(
+          boost::bind(push_back, &v, _1)
+        );
+#else
+    mpl::for_each<numbers>(
+          boost::bind(&std::vector<int>::push_back, &v, _1)
+        );    
+#endif
+
+    mpl::for_each< numbers >(value_printer(std::cout));
+    
+    for (unsigned i = 0; i < v.size(); ++i)
+        assert(v[i] == (int)i);
+
+    return 0;
+}
Added: sandbox/variadic_templates/libs/mpl/test/list_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/mpl/test/list_c.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,109 @@
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/09/10 22:53:37 $
+// $Revision: 1.1 $
+
+#include <boost/mpl/list_c.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/size.hpp>
+#include <boost/static_assert.hpp>
+
+#include <boost/mpl/aux_/test.hpp>
+
+
+//!@nv-mpl_diff:
+//!  WHAT:
+//!    1) expresstions such as:
+//!         list_c<T,c1,c2,...>::type
+//!       were replaced with just:
+//!         list_c<T,c1,c2,...>
+//!  WHY:
+//!    1) list_c<T,c1,c2,...> was changed
+//!       to inheirit from:
+//!       l_item<integral_c<T,c1>,Next>
+//!       where Next was a function of <T,c2,...>
+//!       , and the only purpose of purpose
+//!       of using list_c<T,c1,c2,...>::type
+//!       instead of l_item<integral-c<C1,c1>,Next>
+//!       was to provide another name for T.
+//!       As defined here, T could simply be
+//!       gotten by front<list_c<T,c1...> >::value_type;
+//!       hence, there's no real need for
+//!       list_c<C1,c1,c2,...>::type.
+//!    2) Trying to emulate more precisely the non-variadic
+//!       list_c was proving too difficult.
+//!    3) The only mention of list_c<T,c1,c2,...>::type
+//!       (actually seq_c<T,c1,c2,...>) in:
+//!         http://www.boost.org/doc/libs/1_40_0/libs/mpl/doc/refmanual/integral-sequence-wrapper.html
+//!       is with seqn_c<T1,c1,c2,... cn>.  Since there's no 
+//!       numbered sequences in variadic mpl, that specification
+//!       doesn't apply.
+
+#if !BOOST_WORKAROUND(BOOST_MSVC,<= 1200)
+MPL_TEST_CASE()
+{
+    typedef list_c<bool,true> l1;
+    typedef list_c<bool,false> l2;
+
+    MPL_ASSERT(( is_same< l1::value_type, bool > ));
+    MPL_ASSERT(( is_same< l2::value_type, bool > ));
+
+    MPL_ASSERT_RELATION( front<l1>::type::value, ==, true );
+    MPL_ASSERT_RELATION( front<l2>::type::value, ==, false );
+}
+#endif
+
+MPL_TEST_CASE()
+{
+    typedef list_c<int,-1> l1;
+    typedef list_c<int,0,1> l2;
+    typedef list_c<int,1,2,3> l3;
+
+    MPL_ASSERT(( is_same< l1::value_type, int > ));
+    MPL_ASSERT(( is_same< l2::value_type, int > ));
+    MPL_ASSERT(( is_same< l3::value_type, int > ));
+
+    MPL_ASSERT_RELATION( size<l1>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<l2>::value, ==, 2 );
+    MPL_ASSERT_RELATION( size<l3>::value, ==, 3 );
+    MPL_ASSERT_RELATION( front<l1>::type::value, ==, -1 );
+    MPL_ASSERT_RELATION( front<l2>::type::value, ==, 0 );
+    MPL_ASSERT_RELATION( front<l3>::type::value, ==, 1 );
+}
+
+MPL_TEST_CASE()
+{
+    typedef list_c<unsigned,0> l1;
+    typedef list_c<unsigned,1,2> l2;
+
+    MPL_ASSERT(( is_same< l1::value_type, unsigned > ));
+    MPL_ASSERT(( is_same< l2::value_type, unsigned > ));
+
+    MPL_ASSERT_RELATION( size<l1>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<l2>::value, ==, 2 );
+    MPL_ASSERT_RELATION( front<l1>::type::value, ==, 0 );
+    MPL_ASSERT_RELATION( front<l2>::type::value, ==, 1 );
+}
+
+MPL_TEST_CASE()
+{
+    typedef list_c<unsigned,2,1> l2;
+
+    MPL_ASSERT(( is_same< l2::value_type, unsigned > ));
+    
+    typedef begin<l2>::type i1;
+    typedef next<i1>::type  i2;
+    typedef next<i2>::type  i3;
+    
+    MPL_ASSERT_RELATION( deref<i1>::type::value, ==, 2 );
+    MPL_ASSERT_RELATION( deref<i2>::type::value, ==, 1 );
+    MPL_ASSERT(( is_same< i3, end<l2>::type > ));
+}
Modified: sandbox/variadic_templates/libs/mpl/test/map.cpp
==============================================================================
--- sandbox/variadic_templates/libs/mpl/test/map.cpp	(original)
+++ sandbox/variadic_templates/libs/mpl/test/map.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -40,7 +40,7 @@
 
     MPL_ASSERT_RELATION( size<m>::type::value, ==, 1 );
     MPL_ASSERT_NOT(( empty<m> ));
-    MPL_ASSERT(( is_same< clear<m>::type,map<> > ));
+    MPL_ASSERT(( is_same< clear<m>::type,map0 > ));
     
     MPL_ASSERT(( is_same< at<m,int>::type,unsigned > ));
     MPL_ASSERT(( is_same< at<m,char>::type,void_ > ));
@@ -64,7 +64,7 @@
 
     MPL_ASSERT_RELATION( size<m2>::type::value, ==, 2 );
     MPL_ASSERT_NOT(( empty<m2>::type ));
-    MPL_ASSERT(( is_same< clear<m2>::type,map<> > ));
+    MPL_ASSERT(( is_same< clear<m2>::type,map0 > ));
     MPL_ASSERT(( is_same< at<m2,int>::type,unsigned > ));
     MPL_ASSERT(( is_same< at<m2,char>::type,long > ));
 
@@ -125,12 +125,12 @@
 
 MPL_TEST_CASE()
 {
-    typedef map<> m;
+    typedef map0 m;
     
     MPL_ASSERT_RELATION( size<m>::type::value, ==, 0 );
     MPL_ASSERT(( empty<m>::type ));
 
-    MPL_ASSERT(( is_same< clear<m>::type,map<> > ));
+    MPL_ASSERT(( is_same< clear<m>::type,map0 > ));
     MPL_ASSERT(( is_same< at<m,char>::type,void_ > ));
 
     MPL_ASSERT_NOT(( has_key<m,char>::type ));
@@ -192,5 +192,18 @@
     > mymap;
     
     test<mymap>();
-    test<mymap::type>();
+//!@nv-mpl_diff:
+//!  WHAT:
+//!    removed:
+//!    test<mymap::type>();
+//!  WHY:
+//!    The only mention of map<T1,T2,...TN>::type on:
+//!
+//!      http://www.boost.org/doc/libs/1_40_0/libs/mpl/doc/refmanual/map.html
+//!
+//!    only mentions an equality with mapN<T1,T2,...,TN> (i.e. numbered maps).
+//!    Since there are no numbered maps in variadic mpl, that mention is not
+//!    relevant; hence, that test is unneeded.
+//!    
+
 }
Added: sandbox/variadic_templates/libs/mpl/test/set_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/mpl/test/set_c.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,88 @@
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/09/11 00:24:49 $
+// $Revision: 1.1 $
+
+#include <boost/mpl/set_c.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/size.hpp>
+
+#include <boost/mpl/aux_/test.hpp>
+
+namespace test { namespace {
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+template< typename S, typename S::value_type k > 
+struct at_c
+    : at< S, integral_c<typename S::value_type,k> >::type
+{
+};
+#else
+template< typename S, long k > 
+struct at_c
+    : aux::msvc_eti_base<
+          at< S, integral_c<typename S::value_type,k> >
+        >
+{
+};
+#endif
+}}
+
+//!@nv-mpl_diff:
+//!  See list_c.cpp @nv-mpl_diff.
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
+MPL_TEST_CASE()
+{
+    typedef set_c<bool,true> s1;
+    typedef set_c<bool,false> s2;
+    typedef set_c<bool,true,false> s3;
+
+    MPL_ASSERT_RELATION( size<s1>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<s2>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<s3>::value, ==, 2 );
+
+    MPL_ASSERT(( is_same< s1::value_type, bool > ));
+    MPL_ASSERT(( is_same< s3::value_type, bool > ));
+    MPL_ASSERT(( is_same< s2::value_type, bool > ));
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+    MPL_ASSERT_RELATION( ( test::at_c<s1,true>::value ), ==, true );
+    MPL_ASSERT_RELATION( ( test::at_c<s2,false>::value ), ==, false );
+    MPL_ASSERT_RELATION( ( test::at_c<s3,true>::value ), ==, true );
+    MPL_ASSERT_RELATION( ( test::at_c<s3,false>::value ), ==, false );
+
+    MPL_ASSERT(( is_same< test::at_c<s1,false>::type, void_ > ));
+    MPL_ASSERT(( is_same< test::at_c<s2,true>::type, void_ > ));
+#endif
+}
+#endif
+
+MPL_TEST_CASE()
+{
+    typedef set_c<char,'a'> s1;
+    typedef set_c<char,'a','b','c','d','e','f','g','h'> s2;
+
+    MPL_ASSERT_RELATION( size<s1>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<s2>::value, ==, 8 );
+
+    MPL_ASSERT(( is_same< s1::value_type, char > ));
+    MPL_ASSERT(( is_same< s2::value_type, char > ));
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
+    MPL_ASSERT_RELATION( ( test::at_c<s1,'a'>::value ), ==, 'a' );
+    MPL_ASSERT_RELATION( ( test::at_c<s2,'a'>::value ), ==, 'a' );
+    MPL_ASSERT_RELATION( ( test::at_c<s2,'d'>::value ), ==, 'd'  );
+    MPL_ASSERT_RELATION( ( test::at_c<s2,'h'>::value ), ==, 'h' );
+
+    MPL_ASSERT(( is_same< test::at_c<s1,'z'>::type, void_ > ));
+    MPL_ASSERT(( is_same< test::at_c<s2,'k'>::type, void_ > ));
+#endif
+}
Added: sandbox/variadic_templates/libs/mpl/test/vector_c.cpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/libs/mpl/test/vector_c.cpp	2009-09-11 20:55:14 EDT (Fri, 11 Sep 2009)
@@ -0,0 +1,69 @@
+
+// Copyright Aleksey Gurtovoy 2000-2004
+//
+// Distributed under 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)
+//
+// See http://www.boost.org/libs/mpl for documentation.
+
+// $Id$
+// $Date: 2009/09/11 00:06:21 $
+// $Revision: 1.1 $
+
+#include <boost/mpl/vector_c.hpp>
+#include <boost/mpl/front.hpp>
+#include <boost/mpl/size.hpp>
+
+#include <boost/mpl/aux_/test.hpp>
+
+//!@nv-mpl_diff:
+//!  See list_c.cpp @nv-mpl_diff.
+
+#if !BOOST_WORKAROUND(BOOST_MSVC, <=1200)
+MPL_TEST_CASE()
+{
+    typedef vector_c<bool,true> v1;
+    typedef vector_c<bool,false> v2;
+
+    MPL_ASSERT(( is_same< v1::value_type, bool > ));
+    MPL_ASSERT(( is_same< v2::value_type, bool > ));
+
+    MPL_ASSERT_RELATION( front<v1>::type::value, ==, true );
+    MPL_ASSERT_RELATION( front<v2>::type::value, ==, false );
+}
+#endif
+
+MPL_TEST_CASE()
+{
+    typedef vector_c<int,-1> v1;
+    typedef vector_c<int,0,1> v2;
+    typedef vector_c<int,1,2,3> v3;
+
+    MPL_ASSERT(( is_same< v1::value_type, int > ));
+    MPL_ASSERT(( is_same< v2::value_type, int > ));
+    MPL_ASSERT(( is_same< v3::value_type, int > ));
+
+    MPL_ASSERT_RELATION( size<v1>::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<v2>::value, ==, 2 );
+    MPL_ASSERT_RELATION( size<v3>::value, ==, 3 );
+
+    MPL_ASSERT_RELATION( front<v1>::type::value, ==, -1 );
+    MPL_ASSERT_RELATION( front<v2>::type::value, ==, 0 );
+    MPL_ASSERT_RELATION( front<v3>::type::value, ==, 1 );
+}
+
+MPL_TEST_CASE()
+{
+    typedef vector_c<unsigned,0> v1;
+    typedef vector_c<unsigned,1,2> v2;
+
+    MPL_ASSERT(( is_same< v1::value_type, unsigned > ));
+    MPL_ASSERT(( is_same< v2::value_type, unsigned > ));
+
+    MPL_ASSERT_RELATION( size<v1>::type::value, ==, 1 );
+    MPL_ASSERT_RELATION( size<v2>::type::value, ==, 2 );
+
+    MPL_ASSERT_RELATION( front<v1>::type::value, ==, 0 );
+    MPL_ASSERT_RELATION( front<v2>::type::value, ==, 1 );
+}