Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r57088 - sandbox/itl/libs/itl/example/large_bitset_
From: afojgo_at_[hidden]
Date: 2009-10-23 07:55:39


Author: jofaber
Date: 2009-10-23 07:55:39 EDT (Fri, 23 Oct 2009)
New Revision: 57088
URL: http://svn.boost.org/trac/boost/changeset/57088

Log:
Portability: Adjusted code for gcc-3.4.4. Stable {msvc-8.0, 9.0, gcc-3.4.4}

Text files modified:
   sandbox/itl/libs/itl/example/large_bitset_/bits.hpp | 18 +++++++++++-------
   sandbox/itl/libs/itl/example/large_bitset_/large_bitset.cpp | 12 ++++++------
   sandbox/itl/libs/itl/example/large_bitset_/large_bitset.hpp | 23 ++++++++++++-----------
   3 files changed, 29 insertions(+), 24 deletions(-)

Modified: sandbox/itl/libs/itl/example/large_bitset_/bits.hpp
==============================================================================
--- sandbox/itl/libs/itl/example/large_bitset_/bits.hpp (original)
+++ sandbox/itl/libs/itl/example/large_bitset_/bits.hpp 2009-10-23 07:55:39 EDT (Fri, 23 Oct 2009)
@@ -52,14 +52,18 @@
     return sequence;
 }
 
+} // mini
+
 //[mini_bits_is_set
-template<class NaturalT>
-struct boost::itl::is_set<mini::bits<NaturalT> >
-{
- typedef boost::itl::is_set<mini::bits<NaturalT> > type;
- BOOST_STATIC_CONSTANT(bool, value = true);
-};
+namespace boost { namespace itl
+{
+ template<class NaturalT>
+ struct is_set<mini::bits<NaturalT> >
+ {
+ typedef is_set<mini::bits<NaturalT> > type;
+ BOOST_STATIC_CONSTANT(bool, value = true);
+ };
+}}
 //]
 
-} // mini
 #endif

Modified: sandbox/itl/libs/itl/example/large_bitset_/large_bitset.cpp
==============================================================================
--- sandbox/itl/libs/itl/example/large_bitset_/large_bitset.cpp (original)
+++ sandbox/itl/libs/itl/example/large_bitset_/large_bitset.cpp 2009-10-23 07:55:39 EDT (Fri, 23 Oct 2009)
@@ -50,7 +50,7 @@
     large_bitset<nat, bits8> tall; // small is tall ...
         // ... it really is, because even this 'small' large_bitset
         // can represent up to 2^32-1 == 4,294,967,295 bits.
- // BTW nat is defined as unsigned int.
+ // BTW nat is defined as unsigned int.
 
     cout << "----- Test function test_small() -----------\n";
     cout << "-- Switch on all bits in range [0,64] ------\n";
@@ -72,13 +72,13 @@
     tall -= interval<nat>::rightopen(0,10);
     tall.show_segments();
 
- cout << "-- remove even bits in range [0,72) --------\n";
- int bit;
- for(bit=0; bit<72; bit++) if(!(bit%2)) tall -= bit;
+ cout << "-- remove even bits in range [0,72) --------\n";
+ int bit;
+ for(bit=0; bit<72; bit++) if(!(bit%2)) tall -= bit;
     tall.show_segments();
 
- cout << "-- set odd bits in range [0,72) --------\n";
- for(bit=0; bit<72; bit++) if(bit%2) tall += bit;
+ cout << "-- set odd bits in range [0,72) --------\n";
+ for(bit=0; bit<72; bit++) if(bit%2) tall += bit;
     tall.show_segments();
 
     cout << "--------------------------------------------\n\n";

Modified: sandbox/itl/libs/itl/example/large_bitset_/large_bitset.hpp
==============================================================================
--- sandbox/itl/libs/itl/example/large_bitset_/large_bitset.hpp (original)
+++ sandbox/itl/libs/itl/example/large_bitset_/large_bitset.hpp 2009-10-23 07:55:39 EDT (Fri, 23 Oct 2009)
@@ -116,22 +116,23 @@
 
     void show_segments()const
     {
- ITL_const_FORALL(interval_bitmap_type, it_, _map)
+ for(typename interval_bitmap_type::const_iterator it_ = _map.begin();
+ it_ != _map.end(); ++it_)
         {
             interval_type itv = it_->first;
             bitset_type bits = it_->second;
- cout << itv << "->" << bits.as_string("01") << endl;
+ std::cout << itv << "->" << bits.as_string("01") << std::endl;
         }
     }
 
     void show_matrix(const char off_on[2] = " 1")const
     {
- interval_bitmap_type::const_iterator iter = _map.begin();
+ typename interval_bitmap_type::const_iterator iter = _map.begin();
         while(iter != _map.end())
         {
             element_type fst = iter->first.first(), lst = iter->first.last();
             for(element_type chunk = fst; chunk <= lst; chunk++)
- std::cout << iter->second.as_string(off_on) << endl;
+ std::cout << iter->second.as_string(off_on) << std::endl;
             ++iter;
         }
     }
@@ -139,13 +140,13 @@
 
 //[large_bitset_impl_constants
 private:
- BOOST_STATIC_CONSTANT( chunk_type, bit_count = (sizeof chunk_type)*CHAR_BIT );
- BOOST_STATIC_CONSTANT( chunk_type, divisor = bit_count );
- BOOST_STATIC_CONSTANT( chunk_type, shift = log2_<divisor>::value );
- BOOST_STATIC_CONSTANT( chunk_type, c1 = static_cast<chunk_type>(1) );
- BOOST_STATIC_CONSTANT( chunk_type, mask = divisor - c1 );
- BOOST_STATIC_CONSTANT( chunk_type, all = ~static_cast<chunk_type>(0) );
- BOOST_STATIC_CONSTANT( chunk_type, top = c1 << (bit_count-c1) );
+ BOOST_STATIC_CONSTANT( chunk_type, bit_count = sizeof(chunk_type)*CHAR_BIT );
+ BOOST_STATIC_CONSTANT( chunk_type, divisor = bit_count );
+ BOOST_STATIC_CONSTANT( chunk_type, shift = log2_<divisor>::value );
+ BOOST_STATIC_CONSTANT( chunk_type, c1 = static_cast<chunk_type>(1) );
+ BOOST_STATIC_CONSTANT( chunk_type, mask = divisor - c1 );
+ BOOST_STATIC_CONSTANT( chunk_type, all = ~static_cast<chunk_type>(0) );
+ BOOST_STATIC_CONSTANT( chunk_type, top = c1 << (bit_count-c1) );
     //]
     //[large_bitset_segment_modifier
     typedef void (large_bitset::*segment_modifier)(element_type, element_type, bitset_type);


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