Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62581 - sandbox/SOC/2010/bit_masks/boost/integer/details
From: bbartmanboost_at_[hidden]
Date: 2010-06-08 10:38:32


Author: bbartman
Date: 2010-06-08 10:38:31 EDT (Tue, 08 Jun 2010)
New Revision: 62581
URL: http://svn.boost.org/trac/boost/changeset/62581

Log:
working on creation of couring types for moving template parameters around.
Added:
   sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/details/storage.hpp | 39 ++++++++++++++++++++++++++++++---------
   1 files changed, 30 insertions(+), 9 deletions(-)

Added: sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp
==============================================================================

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/storage.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/storage.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/storage.hpp 2010-06-08 10:38:31 EDT (Tue, 08 Jun 2010)
@@ -8,24 +8,45 @@
 #define BOOST_BIT_MASKS_TAGGED_HPP
 
 #include <allocator>
-
+#include <boost/mpl/void.hpp>
 namespace boost {
 
+/** This forces the storage policy to allocate using the stack.
+ * in stead of using an allocator.
+ */
+struct storage_policy_stack;
+
 /** This structure is used for specifying the storage type within
  * bitfield tuple and bit_mask_tuple.
  * This allos allows the user to specify their own allocator for the internal
  * internal bit data. Thinking about adding a possible specialization
  * for stack allocating the underlying type via a tag or something similar.
- *
- *
+ * In the case of the default allocator there is no need to rebind the
+ * allocator however if the user wishes to supply their own allocator
+ * rebinding must be done just in case its specified incorrectly.
  */
-template < typename StorageType,
- typename Alloc = typename std::allocator<StorageType>
- >
+template < typename StorageType,
+ typename Alloc = typename std::allocator< StorageType >
+>
 struct storage {
- typedef NameType name;
- typedef T value;
- typedef tagged<NameType, T> type;
+ typedef StorageType storage_type;
+ typedef Alloc::template rebind<StorageType>::type alloc;
+ typedef storage<StorageType, Alloc> type;
+};
+
+
+/** The storage policy specifed is to use stack allocation, which means
+ * that an instance of Storage type will need to be created. The instance
+ * is NOT the responsibility of this class. The responsibility of this class
+ * is only to hold policies related to the underlying storage type. It is
+ * the responsibility of the class which revieves this as a template parameter
+ * to then deal with it accordingly.
+ */
+template < typename StorageType>
+struct storage<StorageType< StorageType, storage_policy_stack > {
+ typedef StorageType storage_type;
+ typedef storage_policy_stack alloc;
+ typedef storage<StorageType, storage_policy_stack> type;
 };
 
 } // end boost


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