Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r63055 - in sandbox/SOC/2010/bit_masks: boost/integer boost/integer/details/bft/ext boost/integer/details/bft/ext/fusion lib/integer/test/bft_testing
From: bbartmanboost_at_[hidden]
Date: 2010-06-17 15:05:58


Author: bbartman
Date: 2010-06-17 15:05:52 EDT (Thu, 17 Jun 2010)
New Revision: 63055
URL: http://svn.boost.org/trac/boost/changeset/63055

Log:
caught and fixed bug related to both at_key and advance within the bitfield_tuple_iterator
Text files modified:
   sandbox/SOC/2010/bit_masks/boost/integer/bitfield_tuple.hpp | 22 ++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp | 10 ++++++++++
   sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_key_impl.hpp | 39 +++++++++++++++++++++++++++++++++++++++
   sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp | 7 +++++++
   4 files changed, 78 insertions(+), 0 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-17 15:05:52 EDT (Thu, 17 Jun 2010)
@@ -234,6 +234,28 @@
     std::string to_string() const;
     //@}
 
+ template <typename Name>
+ struct name_exists {
+ typedef typename mpl::not_<
+ is_same <
+ typename ::boost::mpl::find_if<
+ members,
+ ::boost::details::match_name<
+ ::boost::mpl::_1,
+ Name
+ >
+ >::type,
+ typename mpl::end<
+ members
+ >::type
+ >
+ >::type type;
+ };
+
+ template <typename Key>
+ struct find_key {
+
+ };
 
     /** Get function interfaces.
      * These provide access into the tuple via "reference".

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/bitfield_iterator.hpp 2010-06-17 15:05:52 EDT (Thu, 17 Jun 2010)
@@ -163,6 +163,16 @@
         }
     };
 
+ /** Fusion extension: advance. */
+ template <typename Iterator, typename N>
+ struct advance :
+ mpl::if_c<
+ (N::value > 0),
+ fusion::advance_detail::forward<Iterator, N::value>,
+ fusion::advance_detail::backward<Iterator, N::value>
+ >::type
+ { };
+
 };
 
 } // end boost::fusion

Modified: sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_key_impl.hpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_key_impl.hpp (original)
+++ sandbox/SOC/2010/bit_masks/boost/integer/details/bft/ext/fusion/at_key_impl.hpp 2010-06-17 15:05:52 EDT (Thu, 17 Jun 2010)
@@ -2,3 +2,42 @@
 // 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_BITFIELD_TUPLE_FUSION_EXT_AT_IMPL_HPP
+#define BOOST_BITFIELD_TUPLE_FUSION_EXT_AT_IMPL_HPP
+
+
+namespace boost {
+
+struct bitfield_tuple_tag;
+
+namespace fusion { namespace extension {
+
+
+template <typename> struct at_key_impl;
+
+template <>
+struct at_key_impl< bitfield_tuple_tag > {
+
+ template <typename BitfieldTuple, typename Name>
+ struct apply {
+ typedef typename BitfieldTuple::
+ template name_exists<
+ Name
+ >::type
+ found_name;
+ STATIC_ASSERT(( found_name::value ));
+
+
+ //static type call(BitfieldTuple& bft) {
+ // return type( bft.data() );
+ //}
+ };
+};
+
+}}} // end boost::fusion::extension
+
+
+
+
+#endif

Modified: sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp
==============================================================================
--- sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp (original)
+++ sandbox/SOC/2010/bit_masks/lib/integer/test/bft_testing/fusion_integration_testing.cpp 2010-06-17 15:05:52 EDT (Thu, 17 Jun 2010)
@@ -82,6 +82,13 @@
         temp.get<salmon>() = 3;
         BOOST_ASSERT(( fusion::deref(fusion::prior(fusion::end(temp))) == 3 ));
     }
+
+ // at_key
+ {
+ test_tuple temp;
+ temp.get<salmon>() = 3;
+ BOOST_ASSERT(( fusion::at_key<salmon>( temp ) == 3));
+ }
     /*
     bmg_t bmg;
 


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