$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r62647 - in sandbox/SOC/2010/bit_masks/boost/integer: . details
From: bbartmanboost_at_[hidden]
Date: 2010-06-09 07:20:30
Author: bbartman
Date: 2010-06-09 07:20:29 EDT (Wed, 09 Jun 2010)
New Revision: 62647
URL: http://svn.boost.org/trac/boost/changeset/62647
Log:
added additional preconditions and documentation to the bitfield_tupe code and supporitng types
Text files modified: 
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp |    43 +++++++++++++++++---------------------- 
   sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp |     6 ++++                                    
   2 files changed, 24 insertions(+), 25 deletions(-)
Modified: sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp	2010-06-09 07:20:29 EDT (Wed, 09 Jun 2010)
@@ -45,33 +45,17 @@
 
 
 
-/** Default case for managing template parameters. */
+/** This is the empty which prevents the user from supply things which are
+ *  not enclosed within either a member template or a storage template.
+ *  This enforces a domain requirement on the template parameters of
+ *  bitfield_tuple.
+ */
 template <  typename Param,
             typename StoragePolicy,
             typename FieldVector,
             typename Offset
->
-struct bft_impl_;
-#if 0
-{
-    typedef Param           param;
-    typedef FieldVector     field_vector;
-    typedef StoragePolicy   storage_policy;
-    typedef Offset          offset;
+> struct bft_impl_;
 
-    typedef bft_impl_<param,storage_policy,field_vector,offset> type;
-
-    template <typename NextParam>
-    struct process {
-        typedef typename bft_impl_<
-            NextParam,
-            storage_policy,
-            field_vector,
-            offset
-        >::type type;
-    };
-};
-#endif
 
 /** Specialization over mpl::void_. */
 template <  typename StoragePolicy,
@@ -97,7 +81,11 @@
     };
 };
 
-/** Specilization for storage type. */
+/** Specilization for storage type.
+ *  Preconditions enforced on this function :
+ *      For now its going to be documented but not enforeced.
+ *      Do NOT set the storage type more then once!
+ */
 template <  typename StorageType, 
             typename AllocationPolicy,
             typename StoragePolicy,
@@ -134,7 +122,14 @@
     };
 };
 
-/** Specilization for member. */
+/** Specilization for member.
+ *  Documented and enforced preconditions
+ *      1. The user must not supply the same name for more then 1 parameter
+ *      (This may result in additional overhead during compile time ).
+ *      Currently not enforced, will take more time then I have at the moment.
+ */
+
+// TODO: Implement Precondition 1 listed above!
 template <  typename StoragePolicy,
             typename FieldVector,
             typename Offset,
Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp	(original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/member.hpp	2010-06-09 07:20:29 EDT (Wed, 09 Jun 2010)
@@ -8,6 +8,7 @@
 #define BOOST_MEMBER_FIELD_HPP
 #include <cstddef>
 #include <boost/type_traits.hpp>
+#include <boost/static_assert.hpp>
 
 namespace boost {
 
@@ -16,10 +17,13 @@
  *  specifically to associate a group of parameters to gather within a type
  *  and make it easier for the data structure to figure out what to do with
  *  those parameter.
+ *
+ *  Documented and enforced preconditions
+ *      The width of a field must not be 0.
  */
-
 template <typename ReturnType, typename Name, std::size_t FieldWidth>
 struct member {
+    BOOST_STATIC_ASSERT(( FieldWidth != 0 ));
     typedef ReturnType return_type;
     typedef Name name_type;
     BOOST_STATIC_CONSTANT(std::size_t, field_width  = FieldWidth);