Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r71612 - sandbox/block_ptr/boost
From: phil_at_[hidden]
Date: 2011-04-29 17:49:00


Author: pbouchard
Date: 2011-04-29 17:49:00 EDT (Fri, 29 Apr 2011)
New Revision: 71612
URL: http://svn.boost.org/trac/boost/changeset/71612

Log:
* Added default make_block
Text files modified:
   sandbox/block_ptr/boost/block_ptr.hpp | 16 ++++++++++++----
   1 files changed, 12 insertions(+), 4 deletions(-)

Modified: sandbox/block_ptr/boost/block_ptr.hpp
==============================================================================
--- sandbox/block_ptr/boost/block_ptr.hpp (original)
+++ sandbox/block_ptr/boost/block_ptr.hpp 2011-04-29 17:49:00 EDT (Fri, 29 Apr 2011)
@@ -226,6 +226,10 @@
 #define ARGUMENT_DECL(z, n, text) BOOST_PP_COMMA_IF(n) T ## n const & t ## n
 #define PARAMETER_DECL(z, n, text) BOOST_PP_COMMA_IF(n) t ## n
 
+#define BEFRIEND_MAKE_BLOCK(z, n, text) \
+ template <typename V, BOOST_PP_REPEAT(n, TEMPLATE_DECL, 0)> \
+ friend block_ptr<V> text(BOOST_PP_REPEAT(n, ARGUMENT_DECL, 0));
+
 #define CONSTRUCT_MAKE_BLOCK(z, n, text) \
         template <typename V, BOOST_PP_REPEAT(n, TEMPLATE_DECL, 0)> \
                 block_ptr<V> text(BOOST_PP_REPEAT(n, ARGUMENT_DECL, 0)) \
@@ -233,10 +237,6 @@
                         return block_ptr<V>(new block<V>(BOOST_PP_REPEAT(n, PARAMETER_DECL, 0))); \
                 }
 
-#define BEFRIEND_MAKE_BLOCK(z, n, text) \
- template <typename V, BOOST_PP_REPEAT(n, TEMPLATE_DECL, 0)> \
- friend block_ptr<V> text(BOOST_PP_REPEAT(n, ARGUMENT_DECL, 0));
-
 
 /**
         Deterministic memory manager of constant complexity.
@@ -300,6 +300,9 @@
 
                 return * this;
             }
+
+ template <typename V>
+ friend block_ptr<V> make_block();
 
                 BOOST_PP_REPEAT_FROM_TO(1, 10, BEFRIEND_MAKE_BLOCK, make_block)
 
@@ -451,6 +454,11 @@
         }
     };
 
+template <typename V>
+ block_ptr<V> make_block()
+ {
+ return block_ptr<V>(new block<V>());
+ }
 
 BOOST_PP_REPEAT_FROM_TO(1, 10, CONSTRUCT_MAKE_BLOCK, make_block)
 


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