$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r71698 - in sandbox/local: boost/local/aux_ boost/local/aux_/function_macros/code_ boost/local/aux_/type_traits libs/local/doc/qbk libs/local/example tools/setup
From: lorcaminiti_at_[hidden]
Date: 2011-05-03 14:03:52
Author: lcaminiti
Date: 2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
New Revision: 71698
URL: http://svn.boost.org/trac/boost/changeset/71698
Log:
Making all examples compile on MSVC.
Text files modified: 
   sandbox/local/boost/local/aux_/block.hpp                         |     3 +                                       
   sandbox/local/boost/local/aux_/exit.hpp                          |     4 +-                                      
   sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp |    19 ++++------                              
   sandbox/local/boost/local/aux_/type_traits/add_pointed_const.hpp |     4 +-                                      
   sandbox/local/libs/local/doc/qbk/release_notes.qbk               |     3 +                                       
   sandbox/local/libs/local/example/Jamfile.jam                     |    69 ++++++++++++++++++++------------------- 
   sandbox/local/libs/local/example/doit.cpp                        |    24 ++-----------                           
   sandbox/local/libs/local/example/doit_va.cpp                     |    22 +-----------                            
   sandbox/local/libs/local/example/gcc_store.cpp                   |     4 +-                                      
   sandbox/local/libs/local/example/gcc_store_va.cpp                |     4 +-                                      
   sandbox/local/tools/setup/cygwin-boost-env.sh                    |     2                                         
   11 files changed, 64 insertions(+), 94 deletions(-)
Modified: sandbox/local/boost/local/aux_/block.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/block.hpp	(original)
+++ sandbox/local/boost/local/aux_/block.hpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -18,7 +18,8 @@
 #define BOOST_LOCAL_AUX_BLOCK_END(id) \
     /* user block code `{ ... }` here */ \
     /* ends the local function declaration */ \
-    BOOST_LOCAL_FUNCTION_NAME(BOOST_LOCAL_AUX_SYMBOL_BLOCK_FUNCTION_NAME(id)) \
+    BOOST_LOCAL_FUNCTION_NAME(inline /* for optimization (never as tparam) */ \
+            BOOST_LOCAL_AUX_SYMBOL_BLOCK_FUNCTION_NAME(id)) \
     /* call local funciton and execute block's code imediately */ \
     BOOST_LOCAL_AUX_SYMBOL_BLOCK_FUNCTION_NAME(id)(); \
 
Modified: sandbox/local/boost/local/aux_/exit.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/exit.hpp	(original)
+++ sandbox/local/boost/local/aux_/exit.hpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -8,7 +8,7 @@
 #define BOOST_LOCAL_AUX_EXIT_HPP_
 
 #include "symbol.hpp"
-#include "../function.hpp"
+#include <boost/function.hpp>
 #include <boost/preprocessor/cat.hpp>
 
 // PRIVATE //
@@ -39,7 +39,7 @@
 // Resource destructor exec exit code when obj goes out of local scope.
 struct exit_guard {
     // Exit local functions are always void with no params (and no defaults).
-    typedef ::boost::local::function<void ()> functor_type;
+    typedef ::boost::function<void ()> functor_type;
     explicit exit_guard(functor_type f): f_(f) {}
     ~exit_guard() { f_(); } // Invokes function when obj goes out of scope.
 private:
Modified: sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp	(original)
+++ sandbox/local/boost/local/aux_/function_macros/code_/functor.hpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -13,6 +13,7 @@
 #include "../../preprocessor/sign/params_const_bind.hpp"
 #include "../../preprocessor/sign/params_bind.hpp"
 #include "../../scope_exit/scope_exit.hpp" // Use this lib's ScopeExit impl.
+#include "../../type_traits/add_pointed_const.hpp"
 #include "../../../config.hpp"
 #include "../../../function.hpp"
 #include <boost/detail/preprocessor/keyword/auto.hpp>
@@ -106,6 +107,7 @@
 
 #define BOOST_LOCAL_AUX_FUNCTION_CODE_FUNCTOR_MAYBECONST_MEMBER_BIND_( \
         r, offset, i, var) \
+    BOOST_PP_COMMA_IF(i) \
     BOOST_LOCAL_AUX_FUNCTION_CODE_FUNCTOR_MAYBECONST_BIND_MEMBER_VAR_( \
             BOOST_PP_ADD(offset, i))
 
@@ -228,7 +230,7 @@
         BOOST_PP_LIST_FOR_EACH_I( \
                 BOOST_LOCAL_AUX_FUNCTION_CODE_FUNCTOR_UNBIND_ARG_DECL_, \
                 typename_keyword, unbinds) \
-    ) { \
+    ) const { \
         /* just forward call to member function with local func name */ \
         return BOOST_LOCAL_AUX_SYMBOL_BODY_FUNCTION_NAME( \
             BOOST_PP_LIST_FOR_EACH_I( \
@@ -417,7 +419,8 @@
         /* functor type -- this type cannot have ID postfix because it is */ \
         /* used the `NAME` macro (this symbol is within functor class so */ \
         /* it does not have to have ID postfix) */ \
-        typedef ::boost::local::function<BOOST_LOCAL_AUX_SYMBOL_FUNCTION_TYPE, \
+        typedef ::boost::local::aux::function< \
+                BOOST_LOCAL_AUX_SYMBOL_FUNCTION_TYPE, \
                 default_count> BOOST_LOCAL_AUX_SYMBOL_FUNCTOR_TYPE; \
         /* typeof types -- these types are qualified with extra eventual */ \
         /* const and/or & if their variables are bound by const and/or & */ \
@@ -513,15 +516,9 @@
                         /* const-bindparams (could be 0)*/ \
                         BOOST_PP_LIST_SIZE(const_binds)),\
                 binds) \
-        BOOST_PP_EXPR_IIF(has_const_bind_this, /* const bind `this` mem ref */ \
-            typename_keyword ::boost::local::aux::add_pointed_const< \
-                BOOST_LOCAL_AUX_FUNCTION_CODE_BIND_THIS_TYPE(id) \
-            >::type \
-            & /* all bind member vars are refs to ScopeExit struct members */ \
-            BOOST_LOCAL_AUX_FUNCTION_CODE_FUNCTOR_BIND_MEMBER_THIS_ \
-            ; /* end member variable declaration */ \
-        ) \
-        BOOST_PP_EXPR_IIF(has_bind_this, /* bind `this` member reference */ \
+        /* bind this const or not (pointed-const is not added here because */ \
+        /* this is a reference, it is added to the this_ body param instead */ \
+        BOOST_PP_EXPR_IIF(BOOST_PP_BITOR(has_bind_this, has_const_bind_this), \
             BOOST_LOCAL_AUX_FUNCTION_CODE_BIND_THIS_TYPE(id) \
             & /* all bind member vars are refs to ScopeExit struct members */ \
             BOOST_LOCAL_AUX_FUNCTION_CODE_FUNCTOR_BIND_MEMBER_THIS_ \
Modified: sandbox/local/boost/local/aux_/type_traits/add_pointed_const.hpp
==============================================================================
--- sandbox/local/boost/local/aux_/type_traits/add_pointed_const.hpp	(original)
+++ sandbox/local/boost/local/aux_/type_traits/add_pointed_const.hpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -4,8 +4,8 @@
 // License, Version 1.0 (see accompanying file LICENSE_1_0.txt or a
 // copy at http://www.boost.org/LICENSE_1_0.txt).
 
-#ifndef BOOST_LOCAL_AUX_TYPE_TRAITS_POINTED_CONST_HPP_
-#define BOOST_LOCAL_AUX_TYPE_TRAITS_POINTED_CONST_HPP_
+#ifndef BOOST_LOCAL_AUX_TYPE_TRAITS_ADD_POINTED_CONST_HPP_
+#define BOOST_LOCAL_AUX_TYPE_TRAITS_ADD_POINTED_CONST_HPP_
 
 namespace boost { namespace local { namespace aux {
 
Modified: sandbox/local/libs/local/doc/qbk/release_notes.qbk
==============================================================================
--- sandbox/local/libs/local/doc/qbk/release_notes.qbk	(original)
+++ sandbox/local/libs/local/doc/qbk/release_notes.qbk	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -28,6 +28,9 @@
 
 [section TODO]
 
+# Remove all references (docs, doxy, examples, etc) to local::function.
+Make local::function local::aux::function and use boost::function instead.
+
 # Rework factorial_impl and Implementation section.
 
 [endsect]
Modified: sandbox/local/libs/local/example/Jamfile.jam
==============================================================================
--- sandbox/local/libs/local/example/Jamfile.jam	(original)
+++ sandbox/local/libs/local/example/Jamfile.jam	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -14,12 +14,6 @@
 #       Enable GCC C++0x features like lambdas and local types as template
 #       parameters.
 
-import feature ;
-import os ;
-
-exe add : add.cpp ;
-exe add_va : add_va.cpp ;
-
 exe add_block : add_block.cpp ;
 exe add_block_va : add_block_va.cpp ;
 exe add_block_impl : add_block_impl.cpp ;
@@ -34,6 +28,13 @@
 exe add_function : add_function.cpp ;
 exe add_function_va : add_function_va.cpp ;
 
+
+exe add_function_block_exit : add_function_block_exit.cpp ;
+exe add_function_block_exit_va : add_function_block_exit_va.cpp ;
+
+exe add_function_inline : add_function_inline.cpp ;
+exe add_function_inline_va : add_function_inline_va.cpp ;
+
 exe add_optimizers : add_optimizers.cpp ;
 exe add_optimizers_va : add_optimizers_va.cpp ;
 
@@ -43,6 +44,14 @@
 exe add_this : add_this.cpp ;
 exe add_this_va : add_this_va.cpp ;
 
+exe add_using_boost_local : add_using_boost_local.cpp ;
+exe add_using_boost_local_va : add_using_boost_local_va.cpp ;
+exe add_using_local_functor : add_using_local_functor.cpp ;
+exe add_using_global_functor : add_using_global_functor.cpp ;
+exe add_using_0x_lambda : add_using_0x_lambda.cpp ;
+exe add_using_boost_lambda : add_using_boost_lambda.cpp ;
+exe add_using_boost_phoenix : add_using_boost_phoenix.cpp ;
+
 exe add_x_y : add_x_y.cpp ;
 exe add_x_y_va : add_x_y_va.cpp ;
 
@@ -55,7 +64,7 @@
 
 exe factorial : factorial.cpp ;
 exe factorial_va : factorial_va.cpp ;
-exe factorial_impl : factorial_impl.cpp ;
+#exe factorial_impl : factorial_impl.cpp ;
 
 exe find_if : find_if.cpp ;
 exe find_if_va : find_if_va.cpp ;
@@ -78,6 +87,23 @@
 exe print_map : print_map.cpp ;
 exe print_map_va : print_map_va.cpp ;
 
+exe profile_boost_local : profile_boost_local.cpp
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_boost_local_inline : profile_boost_local_inline.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_boost_local_for_loop : profile_boost_local_for_loop.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_local_functor : profile_local_functor.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_global_functor : profile_global_functor.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_0x_lambda : profile_0x_lambda.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_boost_lambda : profile_boost_lambda.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+exe profile_boost_phoenix : profile_boost_phoenix.cpp 
+        ../../..//libboost_chrono ../../..//libboost_system ;
+
 exe scope_guards_errno : scope_guards_errno.cpp ;
 exe scope_guards_errno_va : scope_guards_errno_va.cpp ;
 
@@ -91,6 +117,8 @@
 exe this : this.cpp ;
 exe this_va : this_va.cpp ;
 
+exe tparam_trick : tparam_trick.cpp ;
+
 exe transform : transform.cpp ;
 exe transform_va : transform_va.cpp ;
 
@@ -103,30 +131,3 @@
 exe world_exit : world_exit.cpp ;
 exe world_exit_va : world_exit_va.cpp ;
 
-exe tparam_trick : tparam_trick.cpp ;
-
-exe add_using_boost_local : add_using_boost_local.cpp ;
-exe add_using_boost_local_va : add_usign_boost_local_va.cpp ;
-exe add_using_local_functor : add_using_local_functor.cpp ;
-exe add_using_global_functor : add_using_global_functor.cpp ;
-exe add_using_0x_lambda : add_using_0x_lambda.cpp ;
-exe add_using_boost_lambda : add_using_boost_lambda.cpp ;
-exe add_using_boost_phoenix : add_using_boost_phoenix.cpp ;
-
-exe profile_boost_local : profile_boost_local.cpp
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_boost_local_inline : profile_boost_local_inline.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_boost_local_for_loop : profile_boost_local_for_loop.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_local_functor : profile_local_functor.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_global_functor : profile_global_functor.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_0x_lambda : profile_0x_lambda.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_boost_lambda : profile_boost_lambda.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-exe profile_boost_phoenix : profile_boost_phoenix.cpp 
-        ../../..//libboost_chrono ../../..//libboost_system ;
-
Modified: sandbox/local/libs/local/example/doit.cpp
==============================================================================
--- sandbox/local/libs/local/example/doit.cpp	(original)
+++ sandbox/local/libs/local/example/doit.cpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -9,23 +9,12 @@
 #include <boost/function.hpp>
 #include <iostream>
 
-// Using `function` allows to use the same functor for all calls (regardless of
-// which set of default parameters is specified).
-void doit(boost::local::function< int (int, int), 2 > l) {
-    std::cout << l(1, 2) << std::endl;
-    std::cout << l(1) << std::endl;
-    std::cout << l() << std::endl;
-}
-
-// Using `function` requires different functors for calls with different set of
-// default parameters.
-void doit2(boost::function< int (int, int) > l)
-    { std::cout << l(1, 2) << std::endl; }
 void doit1(boost::function< int (int) > l) { std::cout << l(1) << std::endl; }
+
 void doit0(boost::function< int () > l) { std::cout << l() << std::endl; }
 
 int main() {
-    boost::function<int (int, int)> l2;
+    boost::function< int (int, int) > l2;
 
     {
         int i = 2;
@@ -36,21 +25,16 @@
         } BOOST_LOCAL_FUNCTION_NAME(linear)
 
         // Assign local functions variables.
-        boost::local::function< int (int, int), 2 > l = linear;
-        l(1, 2); l(1); l(); // All calls because of default parameters.
         l2 = linear;
-        l2(1, 2); // Only one call operation (without default parameters).
+        std::cout << l2(1, 2) << std::endl;
 
         // Similarly, pass local functions as a function parameter.
-        doit(linear);
-        std::cout << std::endl;
-        doit2(linear);
         doit1(linear);
         doit0(linear);
     }
         
     if (false) {
-        l2(1, 2); // This wouuld raise run-time error because invalid reference.
+        l2(1, 2); // This would raise run-time error because invalid reference.
     }
 
     return 0;
Modified: sandbox/local/libs/local/example/doit_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/doit_va.cpp	(original)
+++ sandbox/local/libs/local/example/doit_va.cpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -18,23 +18,12 @@
 #include <boost/function.hpp>
 #include <iostream>
 
-// Using `function` allows to use the same functor for all calls (regardless of
-// which set of default parameters is specified).
-void doit(boost::local::function< int (int, int), 2 > l) {
-    std::cout << l(1, 2) << std::endl;
-    std::cout << l(1) << std::endl;
-    std::cout << l() << std::endl;
-}
-
-// Using `function` requires different functors for calls with different set of
-// default parameters.
-void doit2(boost::function< int (int, int) > l)
-    { std::cout << l(1, 2) << std::endl; }
 void doit1(boost::function< int (int) > l) { std::cout << l(1) << std::endl; }
+
 void doit0(boost::function< int () > l) { std::cout << l() << std::endl; }
 
 int main() {
-    boost::function<int (int, int)> l2;
+    boost::function< int (int, int) > l2;
 
     {
         int i = 2;
@@ -45,15 +34,10 @@
         } BOOST_LOCAL_FUNCTION_NAME(linear)
 
         // Assign local functions variables.
-        boost::local::function< int (int, int), 2 > l = linear;
-        l(1, 2); l(1); l(); // All calls because of default parameters.
         l2 = linear;
-        l2(1, 2); // Only one call operation (without default parameters).
+        std::cout << l2(1, 2) << std::endl;
 
         // Similarly, pass local functions as a function parameter.
-        doit(linear);
-        std::cout << std::endl;
-        doit2(linear);
         doit1(linear);
         doit0(linear);
     }
Modified: sandbox/local/libs/local/example/gcc_store.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc_store.cpp	(original)
+++ sandbox/local/libs/local/example/gcc_store.cpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -6,9 +6,9 @@
 
 //[gcc_store_cpp
 #include <boost/local/function.hpp>
+#include <boost/function.hpp>
 
-void intermediate(boost::local::function<void (int, int)> store_func,
-        int size) {
+void intermediate(boost::function< void (int, int) > store_func, int size) {
     store_func(size - 1, -1);
 }
 
Modified: sandbox/local/libs/local/example/gcc_store_va.cpp
==============================================================================
--- sandbox/local/libs/local/example/gcc_store_va.cpp	(original)
+++ sandbox/local/libs/local/example/gcc_store_va.cpp	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -15,9 +15,9 @@
 
 //[gcc_store_va_cpp
 #include <boost/local/function.hpp>
+#include <boost/function.hpp>
 
-void intermediate(boost::local::function<void (int, int)> store_func,
-        int size) {
+void intermediate(boost::function< void (int, int) > store_func, int size) {
     store_func(size - 1, -1);
 }
 
Modified: sandbox/local/tools/setup/cygwin-boost-env.sh
==============================================================================
--- sandbox/local/tools/setup/cygwin-boost-env.sh	(original)
+++ sandbox/local/tools/setup/cygwin-boost-env.sh	2011-05-03 14:03:50 EDT (Tue, 03 May 2011)
@@ -9,5 +9,5 @@
 echo "BOOST_ROOT=$BOOST_ROOT"
 echo "BOOST_BUILD_PATH=$BOOST_BUILD_PATH"
 echo
-echo "Make sure your \"$HOME/user-config.jam" exists and it is correct."
+echo "Make sure your \"$HOME/user-config.jam\" exists and it is correct."