Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65131 - sandbox/variadic_templates/libs/composite_storage/sandbox/pack
From: cppljevans_at_[hidden]
Date: 2010-08-30 09:52:12


Author: cppljevans
Date: 2010-08-30 09:52:11 EDT (Mon, 30 Aug 2010)
New Revision: 65131
URL: http://svn.boost.org/trac/boost/changeset/65131

Log:
WHAT:
  Add macro, ARG_CONSTANCY
WHY:
  Allow compilation. Apparently compiler interprets
  the args as non-constant; so, have to declare signature
  as taking non-const arg. This macro makes it easy to
  switch between non-const and const args to reveal the
  need for non-const args.

Text files modified:
   sandbox/variadic_templates/libs/composite_storage/sandbox/pack/one_of_multiple_dispatch.test.cpp | 38 +++++++++++++++++++++-----------------
   1 files changed, 21 insertions(+), 17 deletions(-)

Modified: sandbox/variadic_templates/libs/composite_storage/sandbox/pack/one_of_multiple_dispatch.test.cpp
==============================================================================
--- sandbox/variadic_templates/libs/composite_storage/sandbox/pack/one_of_multiple_dispatch.test.cpp (original)
+++ sandbox/variadic_templates/libs/composite_storage/sandbox/pack/one_of_multiple_dispatch.test.cpp 2010-08-30 09:52:11 EDT (Mon, 30 Aug 2010)
@@ -25,6 +25,11 @@
   #else
     #define FUNCTOR_CONSTANCY
   #endif
+ #if 0
+ #define ARG_CONSTANCY const
+ #else
+ #define ARG_CONSTANCY
+ #endif
 #define APPLY_UNPACK_USER_CHECKED_ARGS
 #include <boost/composite_storage/pack/multiple_dispatch/reify_apply.hpp>
 #include <boost/composite_storage/pack/multiple_dispatch/reifier_switch.hpp>
@@ -182,6 +187,7 @@
>
 #endif
 {
+ #ifdef APPLY_UNPACK_USER_CHECKED_ARGS
         typedef
       functor_bad_args
       < functor3
@@ -191,37 +197,38 @@
     
     using super_type::operator();
     
+ typedef typename super_type::result_type result_type;
+ #endif
+
     functor3(void)
     {}
     
- typedef typename super_type::result_type result_type;
-
     int operator()(void)FUNCTOR_CONSTANCY
     {
         ind_out<<"functor3:arity=0.\n";
         return 0;
     }
- #if 0
- int operator()( host_concrete<0>const&a0)FUNCTOR_CONSTANCY
+ #if 1
+ int operator()( host_concrete<0> ARG_CONSTANCY &a0)FUNCTOR_CONSTANCY
     {
         ind_out<<"functor3:arity=1:\n";
         ind_out<<":a0="<<a0<<"\n";
         return 0;
     }
- int operator()( host_concrete<1>const&a0)FUNCTOR_CONSTANCY
+ int operator()( host_concrete<1> ARG_CONSTANCY &a0)FUNCTOR_CONSTANCY
     {
         ind_out<<"functor3:arity=1:";
         ind_out<<":a0="<<a0<<"\n";
         return 0;
     }
- int operator()( host_concrete<2>const&a0)FUNCTOR_CONSTANCY
+ int operator()( host_concrete<2> ARG_CONSTANCY &a0)FUNCTOR_CONSTANCY
     {
         ind_out<<"functor3:arity=1:";
         ind_out<<":a0="<<a0<<"\n";
         return 0;
     }
- int operator()( host_concrete<0>const&a0
- , host_concrete<1>const&a1)FUNCTOR_CONSTANCY
+ int operator()( host_concrete<0> ARG_CONSTANCY &a0
+ , host_concrete<1> ARG_CONSTANCY &a1)FUNCTOR_CONSTANCY
     {
         ind_out<<"functor3:arity=2:\n";
         ind_out<<":a0="<<a0<<"\n";
@@ -260,12 +267,9 @@
         {
             ind_out<<"v["<<i<<"].which="<<tagged_v[i].which()<<"\n";
         }
- typedef
- #if 0
- functor_any
- #else
- functor3
- #endif
+ #define FUNCTOR_T functor3
+ typedef
+ FUNCTOR_T
         FUNCTOR_CONSTANCY functor_t;
         functor_t functor_v;
         int result=0;
@@ -300,8 +304,8 @@
           #endif
>( functor_v
           #ifdef REIFIER_VISITOR
- , static_cast<host_abstract<>const&>(host_concrete<0>())
- , static_cast<host_abstract<>const&>(host_concrete<1>())
+ , static_cast<host_abstract<> ARG_CONSTANCY &>(host_concrete<0>())
+ , static_cast<host_abstract<> ARG_CONSTANCY &>(host_concrete<1>())
           #else
             , tagged_v[0]
             //, tagged_v[1]
@@ -311,7 +315,7 @@
             //This should fail compilation with error message
             //something about invalid args.
             #ifdef REIFIER_VISITOR
- , static_cast<host_abstract<>const&>(host_concrete<0>())
+ , static_cast<host_abstract<> ARG_CONSTANCY &>(host_concrete<0>())
             #else
               , tagged_v[0]
             #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk