$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r78360 - sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch
From: cppljevans_at_[hidden]
Date: 2012-05-06 13:50:59
Author: cppljevans
Date: 2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
New Revision: 78360
URL: http://svn.boost.org/trac/boost/changeset/78360
Log:
Refactor reifier's.  Now all are derived frmo reifier_base.
The one's using tagged unions are derived from reifier_indexed_base.
Added reifier_funvec which uses vector of functions instead of
switch to reify the tagged union.
Other changes just involve comments, mostly.
Added:
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_base.hpp   (contents, props changed)
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_funvec.hpp   (contents, props changed)
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_indexed_base.hpp   (contents, props changed)
Text files modified: 
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp                   |    33 +++++++++-                              
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_switch.hpp                 |   119 +++++++-------------------------------- 
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_visitor.hpp                |    77 ++++++++-----------------               
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reify_apply.hpp                    |    27 ++++++---                               
   sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp |     8 +-                                      
   5 files changed, 97 insertions(+), 167 deletions(-)
Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp	(original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/apply_unpack.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -12,6 +12,7 @@
 #include <boost/mpl/package_range_c.hpp>
 #include <boost/type_traits/remove_cv.hpp>
 #include <exception>
+//#define APPLY_UNPACK_USER_CHECKED_ARGS
 #ifndef APPLY_UNPACK_USER_CHECKED_ARGS
   #include <boost/function_types/can_be_called.hpp>
 #endif  
@@ -70,7 +71,7 @@
   template <typename Functor, typename... Args>
     typename functor_result_type<Functor>::type
   apply_ftor_callable_args( mpl::bool_<true>, Functor& ftor
-    , Args const&... args)
+    , Args&... args)
   {
       return ftor(args...);
   };
@@ -78,7 +79,7 @@
   template <typename Functor, typename... Args>
     typename functor_result_type<Functor>::type
   apply_ftor_callable_args( mpl::bool_<false>, Functor& ftor
-    , Args const&... args
+    , Args&... args
     )
   {
       throw bad_functor_args<Functor(Args const&...)>();
@@ -89,7 +90,7 @@
     typename functor_result_type<Functor>::type
   apply_ftor_check_args
     ( Functor& ftor
-    , Args const&... args
+    , Args&... args
     )
     /**@brief
      *  If ftor is callable with args..., does so.
@@ -98,7 +99,7 @@
      */
   {
       typedef typename function_types
-        ::can_be_called<Functor(Args const&...)>::type
+        ::can_be_called<Functor(Args&...)>::type
       is_ftor_args_callable;
       return apply_ftor_callable_args( is_ftor_args_callable()
         , ftor, args...);
@@ -113,8 +114,30 @@
   {
       template <typename Functor, typename ArgsPacked>
         typename functor_result_type<Functor>::type
-      operator()( Functor& a_functor, ArgsPacked const& a_args)
+      operator()
+        ( Functor& a_functor
+        ,   ArgsPacked const
+          & a_args
+        )
       {
+          #ifdef MULTIPLE_DISPATCH_DEBUG
+            std::cout
+            <<__FILE__<<":"<<__LINE__
+            <<":apply_unpack"
+            <<"\n:ArgsPacked="
+            <<utility::demangled_type_name<ArgsPacked>()
+            <<"\n:package_c<unsigned, Indices...>="
+            <<utility::demangled_type_name<mpl::package_c<unsigned, Indices...> >()
+          #if 0
+            //The demangled_type_names uses mpl::for_each, and that requires 
+            //all types being projected have public default CTORS.  Hence,
+            //The above #if is used to disable this call, if that requirement
+            //is not met.
+            <<"\n:a_args.project<Indices>()...="
+            <<utility::demangled_type_names(a_args.template project<Indices>()...)
+          #endif
+            <<"\n";
+          #endif
           return 
           #ifndef APPLY_UNPACK_USER_CHECKED_ARGS
             apply_ftor_check_args( a_functor
Added: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_base.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -0,0 +1,125 @@
+//
+#ifndef BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_BASE_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_BASE_HPP_INCLUDED
+//  (C) Copyright Larry Evans 2010.
+//
+//  Permission to copy, use, modify, sell and distribute this software
+//  is granted provided this copyright notice appears in all copies.
+//  This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+//
+#include <boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp>
+namespace boost
+{
+namespace composite_storage
+{
+namespace pack
+{
+namespace multiple_dispatch
+{
+
+  template
+  < typename ReifyApply
+  , typename ArgsConcreteAbstract
+  >
+struct reifier_base
+;
+  template
+  < typename ReifyApply
+  , typename... HeadConcrete
+  , typename HeadAbstract
+  , typename... TailAbstract
+  >
+struct reifier_base
+  < ReifyApply
+  , ptrs_target_source
+    < mpl::package
+      < HeadConcrete...
+      >
+    , HeadAbstract
+    , TailAbstract...
+    >
+  >
+  /**@brief
+   *  Uses switch statment (in functor_indexed::apply)
+   *  to convert HeadAbstract, which should be of type,
+   *  a composite_storage<one_of_maybe, _, TailConcrete...>, 
+   *  to one of the TailConcretes, and then call
+   *  a ReifyApply with the converted ptrs_target_source.
+   */
+{
+        typedef
+      HeadAbstract
+    head_abstract_t
+    ;
+      ReifyApply const&
+    my_reify
+    ;
+        typedef
+      ptrs_target_source
+      < mpl::package
+        < HeadConcrete...
+        >
+      , head_abstract_t
+      , TailAbstract...
+      >
+    now_tar_src_type
+    ;
+      now_tar_src_type*
+    my_tar_src
+    ;
+    reifier_base
+      ( ReifyApply const& a_reify
+      , now_tar_src_type* a_ptrs_tar_src
+      )
+    : my_reify(a_reify)
+    , my_tar_src(a_ptrs_tar_src)
+    {
+    }
+      head_abstract_t&
+    head_abstract()const
+    {
+        return my_tar_src->template project
+          < sizeof...(HeadConcrete)
+          >();
+    }
+        typedef 
+      typename ReifyApply::result_type 
+    result_type
+    ;
+      template
+      < typename TailConcrete
+      >
+      result_type
+    push_back_concrete
+      ( TailConcrete& a_tail_concrete
+      )const
+      /**@brief
+       *  Casts the head abstract value in the ptrs_target_source
+       *  into a TailConcrete value, and
+       *  then recurses on remaining abstract args
+       *  by calling on my_reify.
+       */
+    {
+            typedef 
+          ptrs_target_source
+          < mpl::package
+            < HeadConcrete...
+            , TailConcrete
+            >
+          , TailAbstract...
+          >
+        next_tar_src_t;
+          next_tar_src_t*
+        next_tar_src_p=replace_source_with_target_ptr(my_tar_src,a_tail_concrete);
+        return my_reify(next_tar_src_p);
+    }
+    
+};
+
+}//exit namespace multiple_dispatch
+}//exit namespace pack
+
+}//exit composite_storage namespace
+}//exit boost namespace
+#endif
Added: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_funvec.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_funvec.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -0,0 +1,170 @@
+//
+#ifndef BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_FUNVEC_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_FUNVEC_HPP_INCLUDED
+//  (C) Copyright Larry Evans 2010.
+//
+//  Permission to copy, use, modify, sell and distribute this software
+//  is granted provided this copyright notice appears in all copies
+//  This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+//
+#include <boost/composite_storage/pack/multiple_dispatch/reifier_indexed_base.hpp>
+
+namespace boost
+{
+namespace composite_storage
+{
+namespace pack
+{
+namespace multiple_dispatch
+{
+
+  template
+  < typename ReifyApply
+  , typename ArgsConcreteAbstract
+  >
+struct reifier_funvec
+: reifier_indexed_base
+  < ReifyApply
+  , ArgsConcreteAbstract
+  >
+  /**@brief
+   *  Uses vector of functions (see static our_vec() below)
+   *  to convert "abstract" head of an ArgsConcreteAbstract to
+   *  its "concrete" counterpart, and then call
+   *  a ReifyApply with the converted ArgsConcreteAbstract.
+   */
+{
+        typedef
+      reifier_indexed_base
+      < ReifyApply
+      , ArgsConcreteAbstract
+      >
+    super_t
+    ;
+    reifier_funvec
+      ( ReifyApply const& a_reify
+      , ArgsConcreteAbstract* a_ptrs_tar_src
+      )
+    : super_t
+      ( a_reify
+      , a_ptrs_tar_src
+      )
+    {
+    }
+        typedef 
+      typename ReifyApply::result_type 
+    result_type
+    ;
+        typedef
+      reifier_funvec
+      < ReifyApply
+      , ArgsConcreteAbstract
+      >
+    this_type
+    ;
+    template<class Case> 
+    struct fun_case
+    {
+            static
+          result_type 
+        _(this_type const& f)
+        {
+            Case arg;
+            return f(arg);
+        }
+    };
+        typedef
+      typename super_t::cases
+    cases
+    ;
+        typedef
+      typename super_t::case_type
+    case_type
+    ;
+    struct fun_vec
+    {
+            typedef
+          result_type
+          (*
+        fun_type
+          )(this_type const&)
+        ;
+            static
+          unsigned const
+        vec_size
+        = boost::mpl::size<cases>::type::value
+        ;
+            typedef
+          fun_type
+        vec_type
+          [ vec_size
+          ]
+        ;
+            static
+          unsigned
+        case_index
+          ( case_type index
+          )
+        {
+            return index-cases::start::value;
+        }
+        struct fill_vec
+        {
+              vec_type&
+            my_vec
+            ;
+            fill_vec(vec_type& a_vec)
+            : my_vec(a_vec)
+            {}
+              template
+              < typename Case
+              >
+              void
+            operator()(Case)
+            {
+                unsigned const index=case_index(Case::value);
+                my_vec[index]=fun_case<Case>::_;
+            }
+        };
+          vec_type
+        my_vec
+        ;
+        fun_vec(void)
+        {
+            boost::mpl::for_each<cases>(fill_vec(my_vec));
+        }
+          fun_type
+        operator[](case_type i)const
+        {
+            unsigned const index=case_index(i);
+            return my_vec[index];
+        }
+          
+    };
+        static
+      fun_vec const&
+    our_vec(void)
+    {
+        static fun_vec const a_vec;
+        return a_vec;
+    }
+      result_type
+    reify_rest
+      ( void
+      )const
+      /**@brief
+       *  Indirectly, calls this->super_t::operator()( mpl::integral_c<case_type,CaseValue> index)
+       *  where CaseValue == head_abstract().which().
+       */
+    {
+        return our_vec()[this->head_abstract().which()](*this);
+    }
+};
+
+}//exit namespace multiple_dispatch
+}//exit namespace pack
+
+}//exit composite_storage namespace
+}//exit boost namespace
+#endif
Added: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_indexed_base.hpp
==============================================================================
--- (empty file)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_indexed_base.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -0,0 +1,108 @@
+//
+#ifndef BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_INDEXED_BASE_HPP_INCLUDED
+#define BOOST_COMPOSITE_STORAGE_PACK_MULTIPLE_DISPATCH_REIFIER_INDEXED_BASE_HPP_INCLUDED
+//  (C) Copyright Larry Evans 2010.
+//
+//  Permission to copy, use, modify, sell and distribute this software
+//  is granted provided this copyright notice appears in all copies.
+//  This software is provided "as is" without express or implied
+//  warranty, and with no claim as to its suitability for any purpose.
+//
+#include <boost/composite_storage/pack/multiple_dispatch/reifier_base.hpp>
+#include <boost/composite_storage/functor_indexed.hpp>
+
+namespace boost
+{
+namespace composite_storage
+{
+namespace pack
+{
+namespace multiple_dispatch
+{
+
+  template
+  < typename ReifyApply
+  , typename ArgsConcreteAbstract
+  >
+struct reifier_indexed_base
+: reifier_base
+  < ReifyApply
+  , ArgsConcreteAbstract
+  >
+{
+        typedef
+      reifier_base
+      < ReifyApply
+      , ArgsConcreteAbstract
+      >
+    super_t
+    ;
+        typedef
+      typename super_t::head_abstract_t
+    head_abstract_t
+    ;
+        typedef
+      typename functor_indexed::layout_visitor
+      < head_abstract_t
+      , typename head_abstract_t::index_undefined
+      >
+    layout_visitor
+    ;
+        typedef
+      typename layout_visitor::case_type
+    case_type
+    ;
+        typedef
+      typename layout_visitor::cases
+    cases
+    ;
+        typedef
+      typename head_abstract_t::index_type
+    index_type
+    ;
+    reifier_indexed_base
+      ( ReifyApply const& a_reify
+      , ArgsConcreteAbstract* a_ptrs_tar_src
+      )
+    : super_t
+      ( a_reify
+      , a_ptrs_tar_src
+      )
+    {
+    }
+        typedef 
+      typename ReifyApply::result_type 
+    result_type
+    ;
+      template
+      < case_type CaseValue
+      >
+      result_type 
+    operator()
+      ( mpl::integral_c<case_type,CaseValue> index
+      )const
+      /**@brief
+       *  "Reifies" the head_abstract() into
+       *  the type indicated by the tag, CaseValue.
+       *  Then calls this->push_back_concrete.
+       */
+    {
+          index_type const 
+        index_concrete=index_type(CaseValue);
+          typename super_t::head_abstract_t&
+        my_head_abstract=this->head_abstract();
+            typedef 
+          decltype(my_head_abstract.template project<index_concrete>()) 
+        tail_type;
+        tail_type& a_tail_concrete=my_head_abstract.template project<index_concrete>();
+        return this->push_back_concrete(a_tail_concrete);
+    }
+        
+};
+
+}//exit namespace multiple_dispatch
+}//exit namespace pack
+
+}//exit composite_storage namespace
+}//exit boost namespace
+#endif
Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_switch.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_switch.hpp	(original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_switch.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -8,8 +8,7 @@
 //  This software is provided "as is" without express or implied
 //  warranty, and with no claim as to its suitability for any purpose.
 //
-#include <boost/composite_storage/functor_indexed.hpp>
-#include <boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp>
+#include <boost/composite_storage/pack/multiple_dispatch/reifier_indexed_base.hpp>
 
 namespace boost
 {
@@ -25,69 +24,31 @@
   , typename ArgsConcreteAbstract
   >
 struct reifier_switch
-;
-  template
-  < typename ReifyApply
-  , typename... HeadConcrete
-  , typename HeadAbstract
-  , typename... TailAbstract
-  >
-struct reifier_switch
+: reifier_indexed_base
   < ReifyApply
-  , ptrs_target_source
-    < mpl::package
-      < HeadConcrete...
-      >
-    , HeadAbstract
-    , TailAbstract...
-    >
+  , ArgsConcreteAbstract
   >
   /**@brief
-   *  Uses switch statment (in superclass) 
-   *  to convert HeadAbstract,
-   *  a composite_storage<one_of_maybe, _, TailConcrete...>
-   *  to one of the TailConcretes, and then call
-   *  a ReifyApply with the converted ptrs_target_source.
+   *  Uses switch statment (in functor_indexed::apply)
+   *  to convert "abstract" head of an ArgsConcreteAbstract to
+   *  its "concrete" counterpart, and then call
+   *  a ReifyApply with the converted ArgsConcreteAbstract.
    */
-: functor_indexed::layout_visitor<HeadAbstract>
 {
         typedef
-      typename functor_indexed::layout_visitor<HeadAbstract>::case_type
-    case_type
-    ;
-        typedef
-      typename HeadAbstract::index_type
-    index_type
-    ;
-      ReifyApply const&
-    my_reify
-    ;
-        typedef
-      ptrs_target_source
-      < mpl::package
-        < HeadConcrete...
-        >
-      , HeadAbstract
-      , TailAbstract...
+      reifier_indexed_base
+      < ReifyApply
+      , ArgsConcreteAbstract
       >
-    now_tar_src_type
-    ;
-      now_tar_src_type*
-    my_tar_src
-    ;
-      HeadAbstract&
-    my_head_abstract
+    super_t
     ;
     reifier_switch
       ( ReifyApply const& a_reify
-      , now_tar_src_type* a_ptrs_tar_src
+      , ArgsConcreteAbstract* a_ptrs_tar_src
       )
-    : my_reify(a_reify)
-    , my_tar_src(a_ptrs_tar_src)
-    , my_head_abstract
-      ( my_tar_src->template project
-        < sizeof...(HeadConcrete)
-        >()
+    : super_t
+      ( a_reify
+      , a_ptrs_tar_src
       )
     {
     }
@@ -95,54 +56,18 @@
       typename ReifyApply::result_type 
     result_type
     ;
- private:   
-      template
-      < typename TailConcrete
-      >
-      result_type
-    push_back_concrete
-      ( TailConcrete& a_tail_concrete
-      )const
-    {
-            typedef 
-          ptrs_target_source
-          < mpl::package
-            < HeadConcrete...
-            , TailConcrete
-            >
-          , TailAbstract...
-          >
-        next_tar_src_t;
-          next_tar_src_t*
-        next_tar_src_p=replace_source_with_target_ptr(my_tar_src,a_tail_concrete);
-        return my_reify(next_tar_src_p);
-    }
-    
- public:
-      template
-      < case_type CaseValue
-      >
-      result_type 
-    operator()
-      ( mpl::integral_c<case_type,CaseValue> index
-      )const
-    {
-        index_type const index_concrete=index_type(CaseValue);
-            typedef 
-          decltype(my_head_abstract.template project<index_concrete>()) 
-        tail_type;
-        tail_type a_tail_concrete=my_head_abstract.template project<index_concrete>();
-        return this->push_back_concrete(a_tail_concrete);
-    }
-        
       result_type
-    operator()
+    reify_rest
       ( void
       )const
+      /**@brief
+       *  Indirectly, calls this->super_t::operator()( mpl::integral_c<case_type,CaseValue> index)
+       *  where CaseValue == head_abstract().which().
+       */
     {
-        return functor_indexed::apply//calls this->operator()(_)
+        return functor_indexed::apply
           ( *this
-          , my_head_abstract.which()//the CaseValue template arg to this->operator()(_).
+          , this->head_abstract().which()
           );
     }
 };
Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_visitor.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_visitor.hpp	(original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reifier_visitor.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -8,7 +8,7 @@
 //  This software is provided "as is" without express or implied
 //  warranty, and with no claim as to its suitability for any purpose.
 //
-#include <boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp>
+#include <boost/composite_storage/pack/multiple_dispatch/reifier_base.hpp>
 #include <boost/mpl/pair.hpp>
 #include <boost/mpl/eval_if.hpp>
 #include <boost/mpl/identity.hpp>
@@ -162,18 +162,7 @@
   , typename ConcreteHead
   >
 struct reifier_visit_concrete_seq
-{
-      typename ReifierVisitor::first
-    visit(ConcreteHead const&a_host)const
-    {
-            typedef
-          typename ReifierVisitor::second
-        self_derived;
-          self_derived  const&
-        self_value=static_cast<self_derived const&>(*this);
-        return self_value.push_back_concrete(a_host);
-    }
-};  
+  ;
   template
   < typename ReifierVisitor
   , typename... ConcreteHosts
@@ -232,6 +221,16 @@
     , TailAbstract...
     >
   >
+: reifier_base
+  < ReifyApply
+  , ptrs_target_source //container of pointers.
+    < mpl::package
+      < HeadConcrete...
+      >
+    , HeadAbstract
+    , TailAbstract...
+    >
+  >
   /**@brief
    *  Uses visitor design pattern (in superclass)
    *  to convert HeadAbstract* to its concrete
@@ -239,7 +238,7 @@
    *  ptrs_target_source, and then call
    *  a ReifyApply with the modified ptrs_target_source.
    */
-: reifier_visit_concrete_seq 
+, reifier_visit_concrete_seq 
   //Uses CRTP:
   //  http://www.informit.com/articles/article.aspx?p=31473&seqNum=3
   //to implement concrete visitor in the visitor design pattern:
@@ -268,9 +267,6 @@
     >::type
   >
 {
-      ReifyApply const&
-    my_reify
-    ;
         typedef
       ptrs_target_source
       < mpl::package
@@ -281,22 +277,20 @@
       >
     now_tar_src_type
     ;
-      now_tar_src_type*
-    my_tar_src
-    ;
-      HeadAbstract&
-    my_head_abstract
+        typedef
+      reifier_base
+      < ReifyApply
+      , now_tar_src_type
+      >
+    super_t
     ;
     reifier_visitor
       ( ReifyApply const& a_reify
       , now_tar_src_type* a_ptrs_tar_src
       )
-    : my_reify(a_reify)
-    , my_tar_src(a_ptrs_tar_src)
-    , my_head_abstract
-      ( my_tar_src->template project
-        < sizeof...(HeadConcrete)
-        >()
+    : super_t
+      ( a_reify
+      , a_ptrs_tar_src
       )
     {
     }
@@ -304,36 +298,13 @@
       typename ReifyApply::result_type 
     result_type
     ;
-      template
-      < typename TailConcrete
-      >
-      result_type
-    push_back_concrete
-      ( TailConcrete& a_tail_concrete
-      )const
-    {
-            typedef 
-          ptrs_target_source
-          < mpl::package
-            < HeadConcrete...
-            , TailConcrete
-            >
-          , TailAbstract...
-          >
-        next_tar_src_t;
-          next_tar_src_t*
-        next_tar_src_p=replace_source_with_target_ptr(my_tar_src,a_tail_concrete);
-        return my_reify(next_tar_src_p);
-    }
-    
       result_type
-    operator()
+    reify_rest
       ( void
       )const
     {
-        return my_head_abstract.accept(*this);
+        return this->head_abstract().accept(*this);
     }
-
 };
 
 }//exit namespace multiple_dispatch
Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reify_apply.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reify_apply.hpp	(original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/reify_apply.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -42,6 +42,12 @@
         , TailAbstract...
         >* tar_src_p
       )const
+      /**@brief
+       *  While there are more abstract arguments,
+       *  create a reifier to convert the next
+       *  abstract arg pointer to a concrete arg pointer,
+       *  and recurse.
+       */
     {
             typedef
           ptrs_target_source
@@ -58,7 +64,9 @@
           ( *this
           , tar_src_p
           );
-        return reifier();
+        return reifier.reify_rest()
+          //Recurse.  This calls back to one of this->operator()(...).
+          ;
     }
 
       template
@@ -75,17 +83,18 @@
       /**@brief
        *  When there are no more abstract arguments
        *  ( presumably after a number of calls to
-       *    the previous member function.
-       *  ) apply my_functor to *tar_src_p.
+       *    the previous operator()(...) member function.
+       *  ) apply my_functor to *tar_src_p nd return result.
        */
     {
         #ifdef MULTIPLE_DISPATCH_DEBUG
           std::cout
-            <<"package<ArgsConcrete...>="
+            <<__FILE__<<":"<<__LINE__
+            <<":package<ArgsConcrete...>="
             <<utility::demangled_type_name<mpl::package<ArgsConcrete...> >()
             <<"\n";
-          return result_type();
-        #else
+          //return result_type();
+        #endif
             apply_unpack
             < typename mpl::package_range_c
               < unsigned
@@ -95,7 +104,6 @@
             >
           uapp;
           return uapp(my_functor,*tar_src_p);
-        #endif
     }
 
 };    
@@ -120,7 +128,7 @@
     ... a_args_abstract
   )
   /**@brief
-   *  Applies Reifier to each argument in a_args_abstract 
+   *  Applies Reifier to each "abstract" argument in a_args_abstract 
    *  to produce a list of concrete arguments, which 
    *  are then passed to a_functor.
    */  
@@ -129,7 +137,8 @@
       < typename remove_reference<ArgsAbstract>::type...
       >::type
     ptrs_target_src_v(a_args_abstract...)
-    //creates container of void pointers to a_args_abstract...
+    //creates container of void pointers to
+    //abstract arguments in a_args_abstract...
     ;
     reify_apply_impl<Reifier,Functor> rai(a_functor); 
   #ifdef MULTIPLE_DISPATCH_DEBUG
Modified: sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp
==============================================================================
--- sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp	(original)
+++ sandbox/variadic_templates/boost/composite_storage/pack/multiple_dispatch/replace_source_with_target_ptr.hpp	2012-05-06 13:50:58 EDT (Sun, 06 May 2012)
@@ -74,8 +74,10 @@
         ptr_type
       my_ptrs[size]
         ;
+    #define VOID_PTR_ARRAY_NO_INIT_LIST 1
+    #ifndef VOID_PTR_ARRAY_NO_INIT_LIST
     #define VOID_PTR_ARRAY_NO_INIT_LIST defined(__clang__)
-    //#define VOID_PTR_ARRAY_NO_INIT_LIST 1
+    #endif
     #if VOID_PTR_ARRAY_NO_INIT_LIST
         template
         < typename... Refs
@@ -147,9 +149,9 @@
               typename result_type<Index>::type
             arg_type;
           #ifdef MULTIPLE_DISPATCH_DEBUG
-            result_type<Index>();
             std::cout
-              <<"project.\n"
+              <<__FILE__<<":"<<__LINE__
+              <<":project(void)const.\n"
               <<":Index="
               <<Index
               <<"\n"