Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62459 - sandbox/SOC/2010/bit_masks/boost/integer/details
From: bbartmanboost_at_[hidden]
Date: 2010-06-05 19:14:14


Author: bbartman
Date: 2010-06-05 19:14:14 EDT (Sat, 05 Jun 2010)
New Revision: 62459
URL: http://svn.boost.org/trac/boost/changeset/62459

Log:
still working on implementing my fusion extention to my bit_mask_group work
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/details/bit_mask_group_impl.hpp | 199 ++++++++++++++++++++++++---------------
   1 files changed, 123 insertions(+), 76 deletions(-)

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-05 19:14:14 EDT (Sat, 05 Jun 2010)
@@ -17,6 +17,12 @@
  * 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.
@@ -26,86 +32,114 @@
  */
 struct bit_mask_group_tag { };
 
-}} // end boost::details
+/** bit_mask_group's sequence iterator tag. */
+struct bit_mask_group_iterator_tag { };
 
+} // end of details namespace.
 
-
-/** Next step in sequence extention.
- * Adding dispatch look up mechanism.
+/** 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.
  */
-namespace boost { namespace fusion { namespace traits {
-
- 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;
- };
-}}} // end boost::fusion::traits
-
-
-/** Iterator type for fusion sequence.
- * This is the iterator for iteration over our sequence.
- */
-namespace boost {
-
-
-/** This is my sequence for iteration over the items in bit_mask_group. */
-template<typename MaskGroup, int Pos>
+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.
- // BOOST_STATIC_ASSERT(Pos >=0 && Pos < 3);
     typedef MaskGroup mask_group;
- typedef boost::mpl::int_<Pos> index;
+ typedef boost::mpl::int_<Pos> index;
     typedef boost::fusion::random_access_traversal_tag category;
+};
+
 
- // bit_mask_group_iterator(Struct& str) { }
+/** tag_of tag dispatch functions which allow me to feed directly into
+ * boost.fusion.
+ */
+namespace fusion { namespace traits {
 
- // Struct& struct_;
+/** 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;
 };
 
-namespace details {
- struct bit_mask_group_iterator_tag { };
-}} // end boost::details
 
+/** 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 traits
+namespace extension {
+
+/** All Forward decalations for all of the impl funcitons used by the fusion
+ * extension process.
+ */
+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
 
-/** providing another type_of specilization for the bit_mask_group's
- * iterator.
- */
-namespace boost { namespace fusion { namespace traits {
 
- template<>
- template <typename MaskGroup, 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
 
 
 namespace boost { namespace fusion { namespace extension {
 
-template<typename>
-struct value_at_impl;
+
 
 template <>
 struct value_at_impl< boost::details::bit_mask_group_iterator_tag > {
     template<typename Iterator>
     struct apply;
 
- template<typename MaskGroup, int Pos>
+ template<typename MaskGroup, unsigned int Pos>
     struct apply< boost::bit_mask_group_iterator<MaskGroup, Pos> > {
         typedef typename MaskGroup::template get_by_index<Pos>::type type;
     };
 };
 
-template <typename>
-struct deref_impl;
+
 
 template<>
 struct deref_impl<boost::details::bit_mask_group_iterator_tag >
@@ -113,7 +147,7 @@
     template<typename Iterator>
     struct apply;
 
- template<typename MaskGroup, int Pos>
+ template<typename MaskGroup, unsigned int Pos>
     struct apply< boost::bit_mask_group_iterator<MaskGroup,Pos> > {
         typedef typename MaskGroup::template get_by_index<Pos>::type mask_type;
 
@@ -124,8 +158,7 @@
     };
 };
 
-template <typename>
-struct next_impl;
+
 
 template<>
 struct next_impl< boost::details::bit_mask_group_iterator_tag > {
@@ -145,8 +178,7 @@
     };
 };
 
-template <typename>
-struct prior_impl;
+
 
 template <>
 struct prior_impl< boost::details::bit_mask_group_iterator_tag > {
@@ -156,7 +188,7 @@
         typedef typename Iterator::index index;
         typedef typename boost::bit_mask_group_iterator<
             mask_group,
- index::value-1
+ index::value - 1
> type;
 
         static type call(Iterator const&) {
@@ -165,8 +197,7 @@
     };
 };
 
-template <typename>
-struct advance_impl;
+
 
 template <>
 struct advance_impl< boost::details::bit_mask_group_iterator_tag > {
@@ -187,8 +218,7 @@
     };
 };
 
-template <typename>
-struct distance_impl;
+
 
 template <>
 struct distance_impl< boost::details::bit_mask_group_iterator_tag > {
@@ -211,8 +241,7 @@
     };
 };
 
-template <typename>
-struct equal_to_impl;
+
 
 template <>
 struct equal_to_impl< boost::details::bit_mask_group_iterator_tag > {
@@ -225,8 +254,14 @@
     { };
 };
 
-template<typename>
-struct is_sequence_impl;
+
+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 > {
@@ -234,8 +269,7 @@
     struct apply : mpl::true_ { };
 };
 
-template <typename>
-struct is_view_impl;
+
 
 template <>
 struct is_view_impl< boost::details::bit_mask_group_tag > {
@@ -243,10 +277,28 @@
     struct apply : mpl::false_ { };
 };
 
-template<typename>
-struct begin_impl;
 
-template<>
+
+
+
+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 {
@@ -258,8 +310,6 @@
 };
 
 
-template<typename>
-struct size_impl;
 
 template<>
 struct size_impl< boost::details::bit_mask_group_tag > {
@@ -269,8 +319,7 @@
     { };
 };
 
-template<typename>
-struct value_at_impl;
+
 
 template <>
 struct value_at_impl< boost::details::bit_mask_group_tag > {
@@ -285,10 +334,10 @@
 };
 
 
-template<typename>
-struct at_impl;
 
-template<>
+
+
+template <>
 struct at_impl< boost::details::bit_mask_group_tag > {
     template <typename MaskGroup, typename N>
     struct apply {
@@ -304,8 +353,6 @@
 };
 
 
-template<typename>
-struct at_key_impl;
 
 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