Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62488 - in sandbox/SOC/2010/bit_masks/boost/integer: . details details/bit_mask_group_fusion_ext details/bit_mask_group_fusion_ext/details
From: bbartmanboost_at_[hidden]
Date: 2010-06-06 12:05:43


Author: bbartman
Date: 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
New Revision: 62488
URL: http://svn.boost.org/trac/boost/changeset/62488

Log:
done moving things around for fusion integration now moving to the tesitng phase of things
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp | 92 --------------
   sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group_fwd.hpp | 6
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/bit_mask_group_iterator.hpp | 100 +++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/at_impl.hpp | 28 ++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/begin_impl.hpp | 25 +++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/category_of_impl.hpp | 21 +++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/end_impl.hpp | 30 ++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_sequence_impl.hpp | 19 ++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_view_impl.hpp | 19 ++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/size_impl.hpp | 21 +++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/value_at_impl.hpp | 25 +++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/fusion_includes.hpp | 11 +
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/tag_of.hpp | 32 ++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_impl.hpp | 258 ++++++++++-----------------------------
   14 files changed, 401 insertions(+), 286 deletions(-)

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -10,21 +10,9 @@
 #include <boost/integer/bit_mask_group_fwd.hpp>
 #include <boost/integer/compound_mask.hpp>
 #include <boost/integer/details/bit_mask_group_impl.hpp>
-#include <boost/mpl/vector.hpp>
-#include <boost/mpl/map.hpp>
-#include <boost/mpl/insert.hpp>
-#include <boost/mpl/push_back.hpp>
-#include <boost/mpl/at.hpp>
-#include <boost/mpl/void.hpp>
-
-
-
 
 namespace boost {
 
-
-
-
 /** This is used for naming/tagging arguments within the bit_mask_group. */
 template <typename T, typename NameType>
 struct tagged {
@@ -33,86 +21,6 @@
     typedef tagged<NameType, T> type;
 };
 
-
-
-// TODO: move this into a sperate file
-namespace details {
-
-typedef mpl::void_ unused_parameter;
-
-/** This is a metafunction which is used for filling an mpl::vector with
- * types which arn't of type unused parameter.
- */
-template <typename T, typename TypeVector, typename NamedTypeMap >
-struct bit_mask_group_impl_ {
-
- typedef bit_mask_group_impl_< T, TypeVector, NamedTypeMap> type;
- typedef T type_added;
- typedef typename mpl::push_back<TypeVector, T>::type type_vector;
- typedef NamedTypeMap named_type_map;
-
-
- // adds to the back of the vector and calls this meta function again.
- template <typename NewT>
- struct add {
- typedef bit_mask_group_impl_< NewT, type_vector, NamedTypeMap> type;
- };
-};
-
-/** Specialization for unused parameters.
- * This is the case where the parameter wasn't used by the user and is instead
- * going to be ignored, however its behavior is going to similar to that of
- * the more general form above.
- */
-template <typename TypeVector, typename NamedTypeMap>
-struct bit_mask_group_impl_< unused_parameter, TypeVector, NamedTypeMap > {
-
- typedef bit_mask_group_impl_<
- unused_parameter,
- TypeVector,
- NamedTypeMap
- > type;
-
- typedef unused_parameter type_added;
- typedef TypeVector type_vector;
- typedef NamedTypeMap named_type_map;
-
- // fake adding the parameter to the TypeVector instead do nothing.
- template <typename NewT>
- struct add {
- typedef bit_mask_group_impl_<NewT, TypeVector, NamedTypeMap > type;
- };
-};
-
-
-/** Used for dealing with the "named" types or types which basically contain a
- * single tag which allows them to be referenced instead of an index.
- */
-template < typename Name,
- typename Value,
- typename TypeVector,
- typename NamedTypeMap>
-struct bit_mask_group_impl_< tagged<Value, Name>, TypeVector, NamedTypeMap>
-{
- typedef bit_mask_group_impl_< Value, TypeVector, NamedTypeMap> type;
- typedef Value type_added;
- typedef typename mpl::push_back<TypeVector, Value>::type type_vector;
- typedef typename mpl::insert<
- NamedTypeMap,mpl::pair<Name, Value>
- >::type named_type_map;
-
- template <typename NewT>
- struct add {
- typedef bit_mask_group_impl_<NewT, type_vector, named_type_map> type;
- };
-};
-
-} // namespace details.
-
-
-
-
-
 /** \name bit_mask_group
  * \brief This a psudo variadic class which uses default template parameters
  * and allows for both named and unnamed mask types to be stored within this

Modified: sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group_fwd.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group_fwd.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/bit_mask_group_fwd.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -6,9 +6,13 @@
 #ifndef BOOST_BIT_MASK_GROUP_FWD_HPP
 #define BOOST_BIT_MASK_GROUP_FWD_HPP
 
-/** Forward declaration of template bit_mask_group. */
+/** Forward declaration of template bit_mask_group and the class used for
+ * associating a name/tag with a particular type within the bit_mask_group.
+ */
 namespace boost {
 
+template <typename T, typename NameType> struct tagged;
+
 template < typename Mask0, typename Mask1, typename Mask2, typename Mask3,
             typename Mask4, typename Mask5, typename Mask6, typename Mask7,
             typename Mask8, typename Mask9

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/bit_mask_group_iterator.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/bit_mask_group_iterator.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/bit_mask_group_iterator.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,100 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+
+
+#ifndef BOOST_BIT_MASK_GROUP_ITERATOR_HPP
+#define BOOST_BIT_MASK_GROUP_ITERATOR_HPP
+
+#include <boost/mpl/int.hpp>
+#include <boost/mpl/assert.hpp>
+#include <boost/mpl/if.hpp>
+#include <boost/mpl/minus.hpp>
+#include <boost/type_traits/is_const.hpp>
+#include <boost/fusion/iterator/iterator_facade.hpp>
+
+namespace boost {
+
+/** This is the iterator which holds the maskgroup and allows
+ * the user to iterate over a bit_mask_group type.
+ * As the type bit_mask_group is trivially constructible, copyable and
+ * destructable there is no member to actually hold any data.
+ */
+template<typename MaskGroup, unsigned int Pos>
+struct bit_mask_group_iterator
+ : boost::fusion::iterator_facade<
+ bit_mask_group_iterator<MaskGroup, Pos>,
+ boost::fusion::random_access_traversal_tag
+ >
+{
+ // TODO: At a later time add preconditions for the iterator.
+ typedef MaskGroup mask_group;
+ typedef boost::mpl::int_<Pos> index;
+ typedef boost::fusion::random_access_traversal_tag category;
+
+ /** value_of. */
+ template <typename Iterator>
+ struct value_of {
+ typedef typename Iterator::mask_group mask_group;
+ typedef typename mask_group::template get_by_index<
+ Iterator::index::value
+ >::type type;
+ };
+
+ /** deref. */
+ template <typename Iterator>
+ struct deref {
+ typedef typename Iterator::mask_group mask_group;
+ typedef typename mask_group::template get_by_index<
+ Iterator::index::value
+ >::type type;
+
+ static type call(Iterator const&){
+ return type();
+ }
+ };
+
+ /** Advance. */
+ template <typename Iterator, typename N>
+ struct advance {
+ typedef typename Iterator::index index;
+ typedef typename Iterator::mask_group mask_group;
+ typedef bit_mask_group_iterator<
+ mask_group,
+ index::value + N::value
+ > type;
+
+ static type call(Iterator const& i) {
+ return type();
+ }
+ };
+
+ /** Next and Prior. */
+ template <typename Iter> struct next : advance<Iter, mpl::int_< 1 > > { };
+ template <typename Iter> struct prior : advance<Iter, mpl::int_<-1> > { };
+
+ /** Distance. */
+ template <typename I1, typename I2>
+ struct distance
+ : mpl::minus<typename I2::index, typename I1::index>
+ {
+ typedef typename
+ mpl::minus<
+ typename I2::index,
+ typename I1::index
+ >::type
+ type;
+
+ static type call(I1 const&, I2 const&) {
+ return type();
+ }
+ };
+
+};
+
+} // end boost
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/at_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/at_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/at_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,28 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_AT_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_AT_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct at_impl< boost::details::bit_mask_group_tag > {
+ template <typename MaskGroup, typename N>
+ struct apply {
+ typedef typename MaskGroup::
+ template get_by_index<
+ N::value
+ >::type
+ type;
+ static typename type::value_type call(MaskGroup&) {
+ return type::value;
+ }
+ };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/begin_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/begin_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/begin_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,25 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_BEGIN_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_BEGIN_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct begin_impl< boost::details::bit_mask_group_tag > {
+ template<typename MaskGroup>
+ struct apply {
+ typedef boost::bit_mask_group_iterator<MaskGroup, 0> type;
+
+ static type call(MaskGroup&) {
+ return type();
+ }
+ };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/category_of_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/category_of_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/category_of_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,21 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_CATEGORY_OF_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_CATEGORY_OF_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct category_of_impl< boost::details::bit_mask_group_tag > {
+ template<typename T>
+ struct apply {
+ typedef random_access_traversal_tag type;
+ };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/end_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/end_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/end_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,30 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_END_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_END_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct end_impl< boost::details::bit_mask_group_tag > {
+ template <typename MaskGroup>
+ struct apply {
+ typedef boost::bit_mask_group_iterator<
+ MaskGroup,
+ mpl::size<
+ typename MaskGroup::mask_vector
+ >::value
+ > type;
+
+ static type call(MaskGroup&) {
+ return type();
+ }
+ };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_sequence_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_sequence_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_sequence_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,19 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_IS_SEQUENCE_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_IS_SEQUENCE_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template<>
+struct is_sequence_impl< boost::details::bit_mask_group_tag > {
+ template<typename T>
+ struct apply : mpl::true_ { };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_view_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_view_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/is_view_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,19 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_IS_VIEW_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_IS_VIEW_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct is_view_impl< boost::details::bit_mask_group_tag > {
+ template <typename Sequence>
+ struct apply : mpl::false_ { };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/size_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/size_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/size_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,21 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_SIZE_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_SIZE_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template<>
+struct size_impl< boost::details::bit_mask_group_tag > {
+ template<typename MaskGroup>
+ struct apply
+ : mpl::size< typename MaskGroup::mask_vector >
+ { };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/value_at_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/value_at_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/details/value_at_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,25 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_FUSION_EXT_VALUE_AT_IMPL_HPP
+#define BOOST_BIT_MASK_GROUP_FUSION_EXT_VALUE_AT_IMPL_HPP
+
+namespace boost { namespace fusion { namespace extension {
+
+template <>
+struct value_at_impl< boost::details::bit_mask_group_tag > {
+ template <typename MaskGroup, typename N>
+ struct apply {
+ typedef typename MaskGroup::
+ template get_by_index<
+ N::value
+ >::type
+ type;
+ };
+};
+
+}}} // end boost::fusion::extension
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/fusion_includes.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/fusion_includes.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/fusion_includes.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -23,7 +23,16 @@
 
 /** Fusion sequence extension files. */
 #include "details/tag_and_fusion_fwd.hpp"
+#include "bit_mask_group_iterator.hpp"
+#include "tag_of.hpp"
+#include "details/category_of_impl.hpp"
+#include "details/is_sequence_impl.hpp"
+#include "details/is_view_impl.hpp"
+#include "details/end_impl.hpp"
+#include "details/begin_impl.hpp"
+#include "details/size_impl.hpp"
+#include "details/value_at_impl.hpp"
+#include "details/at_impl.hpp"
 
-// #include "details/tag_and_fusion_fwd.hpp"
 
 #endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/tag_of.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/tag_of.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_fusion_ext/tag_of.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -0,0 +1,32 @@
+// Copyright 2010 Brian Bartman.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_BIT_MASK_GROUP_TAG_OF_HPP
+#define BOOST_BIT_MASK_GROUP_TAG_OF_HPP
+
+namespace boost { namespace fusion { namespace traits {
+
+/** bit_mask_group specilization. */
+template<>
+template < typename Mask0, typename Mask1, typename Mask2, typename Mask3,
+ typename Mask4, typename Mask5, typename Mask6, typename Mask7,
+ typename Mask8,typename Mask9 >
+struct tag_of< boost::bit_mask_group<Mask0, Mask1, Mask2, Mask3, Mask4,
+ Mask5, Mask6, Mask7, Mask8, Mask9 > >
+{
+ typedef boost::details::bit_mask_group_tag type;
+};
+
+
+/** Iterator tag_of specilization. */
+template<>
+template <typename MaskGroup, unsigned int Pos>
+struct tag_of< boost::bit_mask_group_iterator<MaskGroup,Pos> > {
+ typedef boost::details::bit_mask_group_iterator_tag type;
+};
+
+}}} // end boost::fusion::traits
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_impl.hpp 2010-06-06 12:05:41 EDT (Sun, 06 Jun 2010)
@@ -12,120 +12,93 @@
 #include <boost/type_traits.hpp>
 #include <boost/mpl/minus.hpp>
 #include <boost/mpl/size.hpp>
+#include <boost/mpl/vector.hpp>
+#include <boost/mpl/map.hpp>
+#include <boost/mpl/insert.hpp>
+#include <boost/mpl/push_back.hpp>
+#include <boost/mpl/at.hpp>
+#include <boost/mpl/void.hpp>
+#include <boost/integer/details/bit_mask_group_fusion_ext/fusion_includes.hpp>
 
-/** This is used for creating an extention into the boost fusion library for
- * the bit_mask_group.
- */
-namespace boost {
-/** Forward declaration of the iterator, for the fusion sequence extention
- * bit_mask_group
- */
-template<typename MaskGroup, unsigned int Pos>
-struct bit_mask_group_iterator;
 
-namespace details {
-/** Sequence tag.
- * This is used for the boost.fusion extention.
- * Used for dispatching to function overloads.
- * The only thing needed for this is the declaration but just in case I have
- * provided an empty definition.
- */
-struct bit_mask_group_tag { };
 
-/** bit_mask_group's sequence iterator tag. */
-struct bit_mask_group_iterator_tag { };
+namespace boost { namespace details {
 
-} // end of details namespace.
+typedef mpl::void_ unused_parameter;
 
-/** This is the iterator which holds the maskgroup and allows
- * the user to iterate over a bit_mask_group type.
- * As the type bit_mask_group is trivially constructible, copyable and
- * destructable there is no member to actually hold any data.
+/** This is a metafunction which is used for filling an mpl::vector with
+ * types which arn't of type unused parameter.
  */
-template<typename MaskGroup, unsigned int Pos>
-struct bit_mask_group_iterator
- : boost::fusion::iterator_base< bit_mask_group_iterator<MaskGroup, Pos> >
-{
- // TODO: At a later time add preconditions for the iterator.
- typedef MaskGroup mask_group;
- typedef boost::mpl::int_<Pos> index;
- typedef boost::fusion::random_access_traversal_tag category;
-};
+template <typename T, typename TypeVector, typename NamedTypeMap >
+struct bit_mask_group_impl_ {
 
+ typedef bit_mask_group_impl_< T, TypeVector, NamedTypeMap> type;
+ typedef T type_added;
+ typedef typename mpl::push_back<TypeVector, T>::type type_vector;
+ typedef NamedTypeMap named_type_map;
 
-/** tag_of tag dispatch functions which allow me to feed directly into
- * boost.fusion.
- */
-namespace fusion { namespace traits {
 
-/** bit_mask_group specilization. */
-template<>
-template < typename Mask0, typename Mask1, typename Mask2, typename Mask3,
- typename Mask4, typename Mask5, typename Mask6, typename Mask7,
- typename Mask8,typename Mask9 >
-struct tag_of< boost::bit_mask_group<Mask0, Mask1, Mask2, Mask3, Mask4,
- Mask5, Mask6, Mask7, Mask8, Mask9 > >
-{
- typedef boost::details::bit_mask_group_tag type;
+ // adds to the back of the vector and calls this meta function again.
+ template <typename NewT>
+ struct add {
+ typedef bit_mask_group_impl_< NewT, type_vector, NamedTypeMap> type;
+ };
 };
 
+/** Specialization for unused parameters.
+ * This is the case where the parameter wasn't used by the user and is instead
+ * going to be ignored, however its behavior is going to similar to that of
+ * the more general form above.
+ */
+template <typename TypeVector, typename NamedTypeMap>
+struct bit_mask_group_impl_< unused_parameter, TypeVector, NamedTypeMap > {
 
-/** Iterator tag_of specilization. */
-template<>
-template <typename MaskGroup, unsigned int Pos>
-struct tag_of< boost::bit_mask_group_iterator<MaskGroup,Pos> > {
- typedef boost::details::bit_mask_group_iterator_tag type;
+ typedef bit_mask_group_impl_<
+ unused_parameter,
+ TypeVector,
+ NamedTypeMap
+ > type;
+
+ typedef unused_parameter type_added;
+ typedef TypeVector type_vector;
+ typedef NamedTypeMap named_type_map;
+
+ // fake adding the parameter to the TypeVector instead do nothing.
+ template <typename NewT>
+ struct add {
+ typedef bit_mask_group_impl_<NewT, TypeVector, NamedTypeMap > type;
+ };
 };
 
-} // end traits
-namespace extension {
 
-/** All Forward decalations for all of the impl funcitons used by the fusion
- * extension process.
+/** Used for dealing with the "named" types or types which basically contain a
+ * single tag which allows them to be referenced instead of an index.
  */
-template <typename> struct value_at_impl;
-template <typename> struct deref_impl;
-template <typename> struct next_impl;
-template <typename> struct prior_impl;
-template <typename> struct advance_impl;
-template <typename> struct distance_impl;
-template <typename> struct equal_to_impl;
-template <typename> struct category_of_impl;
-template <typename> struct is_sequence_impl;
-template <typename> struct is_view_impl;
-template <typename> struct begin_impl;
-template <typename> struct end_impl;
-template <typename> struct size_impl;
-template <typename> struct value_at_impl;
-template <typename> struct at_impl;
-template <typename> struct at_key_impl;
-
-/** Forward declaration of all spcilizations. */
-// iterator overloads.
-template <> struct value_at_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct deref_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct next_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct prior_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct advance_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct distance_impl< boost::details::bit_mask_group_iterator_tag >;
-template <> struct equal_to_impl< boost::details::bit_mask_group_iterator_tag >;
-// sequence overloads.
-template <> struct category_of_impl< boost::details::bit_mask_group_tag >;
-template <> struct begin_impl< boost::details::bit_mask_group_tag >;
-template <> struct end_impl< boost::details::bit_mask_group_tag >;
-template <> struct size_impl< boost::details::bit_mask_group_tag >;
-template <> struct value_at_impl< boost::details::bit_mask_group_tag >;
-template <> struct at_impl< boost::details::bit_mask_group_tag >;
-template <> struct at_key_impl< boost::details::bit_mask_group_tag >;
-} // end extension
-} // end fusion
-} // end boost
+template < typename Name,
+ typename Value,
+ typename TypeVector,
+ typename NamedTypeMap>
+struct bit_mask_group_impl_< tagged<Value, Name>, TypeVector, NamedTypeMap>
+{
+ typedef bit_mask_group_impl_< Value, TypeVector, NamedTypeMap> type;
+ typedef Value type_added;
+ typedef typename mpl::push_back<TypeVector, Value>::type type_vector;
+ typedef typename mpl::insert<
+ NamedTypeMap,mpl::pair<Name, Value>
+ >::type named_type_map;
 
+ template <typename NewT>
+ struct add {
+ typedef bit_mask_group_impl_<NewT, type_vector, named_type_map> type;
+ };
+};
 
+} } // end details
 
 
 namespace boost { namespace fusion { namespace extension {
-
+//TODO: May not need the impl overloads for the iterator because its gets
+// done implicitly somewhere else.
 
 
 template <>
@@ -255,105 +228,6 @@
 };
 
 
-template <>
-struct category_of_impl< boost::details::bit_mask_group_tag > {
- template<typename T>
- struct apply {
- typedef random_access_traversal_tag type;
- };
-};
-
-template<>
-struct is_sequence_impl< boost::details::bit_mask_group_tag > {
- template<typename T>
- struct apply : mpl::true_ { };
-};
-
-
-
-template <>
-struct is_view_impl< boost::details::bit_mask_group_tag > {
- template <typename Sequence>
- struct apply : mpl::false_ { };
-};
-
-
-
-
-
-template <>
-struct end_impl< boost::details::bit_mask_group_tag > {
- template <typename MaskGroup>
- struct apply {
- typedef boost::bit_mask_group_iterator<
- MaskGroup,
- mpl::size<
- typename MaskGroup::mask_vector
- >::value
- > type;
-
- static type call(MaskGroup&) {
- return type();
- }
- };
-};
-
-template <>
-struct begin_impl< boost::details::bit_mask_group_tag > {
- template<typename MaskGroup>
- struct apply {
- typedef boost::bit_mask_group_iterator<MaskGroup, 0> type;
- static type call(MaskGroup&) {
- return type();
- }
- };
-};
-
-
-
-template<>
-struct size_impl< boost::details::bit_mask_group_tag > {
- template<typename MaskGroup>
- struct apply
- : mpl::size< typename MaskGroup::mask_vector >
- { };
-};
-
-
-
-template <>
-struct value_at_impl< boost::details::bit_mask_group_tag > {
- template <typename MaskGroup, typename N>
- struct apply {
- typedef typename MaskGroup::
- template get_by_index<
- N::value
- >::type
- type;
- };
-};
-
-
-
-
-
-template <>
-struct at_impl< boost::details::bit_mask_group_tag > {
- template <typename MaskGroup, typename N>
- struct apply {
- typedef typename MaskGroup::
- template get_by_index<
- N::value
- >::type
- type;
- static typename type::value_type call(MaskGroup&) {
- return type::value;
- }
- };
-};
-
-
-
 template<>
 struct at_key_impl< boost::details::bit_mask_group_tag > {
 


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