mirror of
https://github.com/boostorg/dynamic_bitset.git
synced 2026-01-26 06:32:11 +00:00
Compare commits
17 Commits
boost-1.29
...
boost-1.30
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b1fcc1e54 | ||
|
|
4a44c8fdf5 | ||
|
|
c3ecab1edc | ||
|
|
2588fb047a | ||
|
|
87ac6004b2 | ||
|
|
571ea640e1 | ||
|
|
6fc5896e72 | ||
|
|
a5cad3ad88 | ||
|
|
f4a45420c0 | ||
|
|
4dbeae0c34 | ||
|
|
8424ddf9aa | ||
|
|
644da01f9c | ||
|
|
3a15e6bc7d | ||
|
|
d02ea45d32 | ||
|
|
944e625455 | ||
|
|
43a44321d0 | ||
|
|
946403a28d |
@@ -66,7 +66,7 @@ struct bitset_test {
|
||||
if (! (str[i] == '0' || str[i] == '1'))
|
||||
any_non_zero_or_one = true;
|
||||
if (any_non_zero_or_one) {
|
||||
// Input does not satisfy precondition.
|
||||
// Input does not satisfy precondition.
|
||||
} else {
|
||||
// Construct an object, initializing the first M bit position to
|
||||
// values determined from the corresponding characters in the
|
||||
@@ -93,12 +93,25 @@ struct bitset_test {
|
||||
// PRE: std::equal(first1, last1, first2) == true
|
||||
static void from_block_range(std::vector<Block> blocks)
|
||||
{
|
||||
Bitset bset(blocks.begin(), blocks.end());
|
||||
std::size_t n = blocks.size();
|
||||
for (std::size_t b = 0; b < n; ++b) {
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
{
|
||||
Bitset bset(blocks.begin(), blocks.end());
|
||||
std::size_t n = blocks.size();
|
||||
for (std::size_t b = 0; b < n; ++b) {
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
Bitset bset(blocks.size() * sizeof(Block) * CHAR_BIT);
|
||||
boost::from_block_range(blocks.begin(), blocks.end(), bset);
|
||||
std::size_t n = blocks.size();
|
||||
for (std::size_t b = 0; b < n; ++b) {
|
||||
for (std::size_t i = 0; i < sizeof(Block) * CHAR_BIT; ++i) {
|
||||
std::size_t bit = b * sizeof(Block) * CHAR_BIT + i;
|
||||
BOOST_CHECK(bset[bit] == nth_bit(blocks[b], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -518,15 +531,15 @@ struct bitset_test {
|
||||
{
|
||||
if (a.is_subset_of(b)) {
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
} else {
|
||||
bool is_subset = true;
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
BOOST_CHECK(is_subset == false);
|
||||
}
|
||||
}
|
||||
@@ -535,16 +548,16 @@ struct bitset_test {
|
||||
{
|
||||
if (a.is_proper_subset_of(b)) {
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
if (a[I])
|
||||
BOOST_CHECK(b[I]);
|
||||
BOOST_CHECK(a.count() < b.count());
|
||||
} else {
|
||||
bool is_subset = true;
|
||||
for (std::size_t I = 0; I < a.size(); ++I)
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
if (a[I] && !b[I]) {
|
||||
is_subset = false;
|
||||
break;
|
||||
}
|
||||
BOOST_CHECK(is_subset == false || a.count() >= b.count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
@@ -29,7 +36,7 @@ void run_test_cases()
|
||||
std::size_t N, ul_size = CHAR_BIT * sizeof(unsigned long),
|
||||
block_size = CHAR_BIT * sizeof(Block);
|
||||
unsigned long numbers[] = { 0, 40247,
|
||||
std::numeric_limits<unsigned long>::max() };
|
||||
std::numeric_limits<unsigned long>::max() };
|
||||
|
||||
//=====================================================================
|
||||
// Test construction from unsigned long
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
@@ -230,3 +237,4 @@ test_main(int argc, char*[])
|
||||
run_test_cases<unsigned long>();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cmath> // for pow
|
||||
|
||||
@@ -1280,6 +1280,22 @@ Iterator</a> and its <tt>value_type</tt> must be the same type as
|
||||
or equal <tt>b.num_blocks()</tt>.
|
||||
|
||||
|
||||
<hr>
|
||||
<pre>
|
||||
template <typename BlockIterator, typename Block, typename Alloc>
|
||||
void <a name="from_block_range">from_block_range</a>(BlockIterator first,
|
||||
BlockIterator last, const dynamic_bitset<Block, Alloc>& b)
|
||||
</pre>
|
||||
<b>Effects:</b> Reads blocks from the iterator range into the
|
||||
bitset. <br>
|
||||
|
||||
<b>Requires:</b> The type <tt>BlockIterator</tt> must be a model of <a
|
||||
href="http://www.sgi.com/tech/stl/InputIterator.html">Input
|
||||
Iterator</a> and its <tt>value_type</tt> must be the same type as
|
||||
<tt>Block</tt>. The size of the iterator range must be less or equal
|
||||
to <tt>b.num_blocks()</tt>.
|
||||
|
||||
|
||||
<hr>
|
||||
<pre>
|
||||
template <typename Char, typename Traits, typename Block, typename Alloc>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// (C) Copyright Chuck Allison and Jeremy Siek 2001, 2002.
|
||||
// (C) Copyright Chuck Allison and Jeremy Siek 2001, 2002.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
@@ -45,7 +45,7 @@ namespace boost {
|
||||
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
class dynamic_bitset_base :
|
||||
class dynamic_bitset_base :
|
||||
#ifdef BOOST_DYN_BITSET_USE_FRIENDS
|
||||
protected
|
||||
#else
|
||||
@@ -64,13 +64,8 @@ namespace boost {
|
||||
|
||||
dynamic_bitset_base(size_type num_bits, const Allocator& alloc)
|
||||
: dynamic_bitset_alloc_base<Allocator>(alloc),
|
||||
#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // Dinkumware for VC6/7
|
||||
m_bits(dynamic_bitset_alloc_base<Allocator>::
|
||||
m_alloc.allocate(calc_num_blocks(num_bits), 0)),
|
||||
#else
|
||||
m_bits(dynamic_bitset_alloc_base<Allocator>::
|
||||
m_alloc.allocate(calc_num_blocks(num_bits))),
|
||||
#endif
|
||||
m_alloc.allocate(calc_num_blocks(num_bits), static_cast<void const *>(0))),
|
||||
m_num_bits(num_bits),
|
||||
m_num_blocks(calc_num_blocks(num_bits))
|
||||
{
|
||||
@@ -82,7 +77,7 @@ namespace boost {
|
||||
this->m_alloc.deallocate(m_bits, m_num_blocks);
|
||||
}
|
||||
#ifdef BOOST_DYN_BITSET_USE_FRIENDS
|
||||
protected:
|
||||
protected:
|
||||
#endif
|
||||
Block* m_bits;
|
||||
size_type m_num_bits;
|
||||
@@ -92,7 +87,7 @@ namespace boost {
|
||||
static size_type offset(size_type bit){ return bit % bits_per_block; } // [gps]
|
||||
static Block mask1(size_type bit) { return Block(1) << offset(bit); }
|
||||
static Block mask0(size_type bit) { return ~(Block(1) << offset(bit)); }
|
||||
static size_type calc_num_blocks(size_type num_bits)
|
||||
static size_type calc_num_blocks(size_type num_bits)
|
||||
{ return (num_bits + bits_per_block - 1) / bits_per_block; }
|
||||
};
|
||||
|
||||
@@ -132,13 +127,13 @@ namespace boost {
|
||||
{
|
||||
// Automatically generated by GPTableGen.exe v.1.0
|
||||
//
|
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
|
||||
};
|
||||
|
||||
@@ -147,26 +142,26 @@ namespace boost {
|
||||
|
||||
template <typename BlockInputIterator>
|
||||
std::size_t initial_num_blocks(BlockInputIterator first,
|
||||
BlockInputIterator last,
|
||||
std::input_iterator_tag)
|
||||
BlockInputIterator last,
|
||||
std::input_iterator_tag)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename BlockForwardIterator>
|
||||
std::size_t initial_num_blocks(BlockForwardIterator first,
|
||||
BlockForwardIterator last,
|
||||
std::forward_iterator_tag)
|
||||
BlockForwardIterator last,
|
||||
std::forward_iterator_tag)
|
||||
{
|
||||
std::size_t n = 0;
|
||||
while (first != last)
|
||||
++first, ++n;
|
||||
++first, ++n;
|
||||
return n;
|
||||
}
|
||||
|
||||
template <typename BlockInputIterator>
|
||||
std::size_t initial_num_blocks(BlockInputIterator first,
|
||||
BlockInputIterator last)
|
||||
BlockInputIterator last)
|
||||
{
|
||||
typename detail::iterator_traits<BlockInputIterator>::iterator_category cat;
|
||||
return initial_num_blocks(first, last, cat);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// (C) Copyright Chuck Allison and Jeremy Siek 2001, 2002.
|
||||
// (C) Copyright Chuck Allison and Jeremy Siek 2001, 2002.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
@@ -6,17 +6,33 @@
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
// With optimizations by Gennaro Prota.
|
||||
// With optimizations, bug fixes, and improvements by Gennaro Prota.
|
||||
|
||||
// See http://www.boost.org/libs/dynamic_bitset for documentation.
|
||||
|
||||
// -------------------------------------
|
||||
// CHANGE LOG:
|
||||
//
|
||||
// - corrected workaround for Dinkum lib's allocate() [GP]
|
||||
// - changed macro test for old iostreams [GP]
|
||||
// - removed #include <vector> for now. [JGS]
|
||||
// - Added __GNUC__ to compilers that cannot handle the constructor from basic_string. [JGS]
|
||||
// - corrected to_block_range [GP]
|
||||
// - corrected from_block_range [GP]
|
||||
// - Removed __GNUC__ from compilers that cannot handle the constructor
|
||||
// from basic_string and added the workaround suggested by GP. [JGS]
|
||||
// - Removed __BORLANDC__ from the #if around the basic_string
|
||||
// constructor. Luckily the fix by GP for g++ also fixes Borland. [JGS]
|
||||
|
||||
#ifndef BOOST_DYNAMIC_BITSET_HPP
|
||||
#define BOOST_DYNAMIC_BITSET_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <cassert>
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
#include <cstring> // for memset, memcpy, memcmp, etc.
|
||||
#include <stdexcept> // for std::domain_error
|
||||
#include <stdexcept> // for std::overflow_error
|
||||
#include <algorithm> // for std::swap, std::min, std::copy, std::fill
|
||||
|
||||
#if defined(__GNUC__) && !defined(__SGI_STL_PORT)
|
||||
@@ -25,17 +41,15 @@
|
||||
#include <cctype> // for isspace
|
||||
#endif
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "boost/dynamic_bitset_fwd.hpp" //G.P.S.
|
||||
#include "boost/detail/dynamic_bitset.hpp"
|
||||
|
||||
#ifdef __GNUC__ // this isn't right... what's the right way to detect?
|
||||
#if defined (__STL_CONFIG_H) && !defined (__STL_USE_NEW_IOSTREAMS)
|
||||
#define BOOST_OLD_IOSTREAMS
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
// in certain situations VC++ requires a redefinition of
|
||||
// default template arguments, in contrast with 14.1/12
|
||||
//
|
||||
@@ -52,7 +66,7 @@ namespace boost {
|
||||
template <typename Block, typename Allocator>
|
||||
#endif
|
||||
|
||||
class dynamic_bitset :
|
||||
class dynamic_bitset :
|
||||
#ifdef BOOST_DYN_BITSET_USE_FRIENDS
|
||||
private
|
||||
#else
|
||||
@@ -74,7 +88,7 @@ public:
|
||||
friend class dynamic_bitset<Block, Allocator>;
|
||||
dynamic_bitset* bs;
|
||||
size_type bit;
|
||||
reference(); // intentionally not implemented
|
||||
reference(); // intentionally not implemented
|
||||
reference(dynamic_bitset& bs_, size_type bit_) : bs(&bs_), bit(bit_){ }
|
||||
public:
|
||||
reference& operator=(bool value) // for b[i] = x
|
||||
@@ -83,30 +97,30 @@ public:
|
||||
bs->set(bit);
|
||||
else
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator|=(bool value) // for b[i] |= x
|
||||
{
|
||||
if (value)
|
||||
bs->set(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator&=(bool value) // for b[i] &= x
|
||||
{
|
||||
if (! (value && bs->test(bit)))
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator^=(bool value) // for b[i] ^= x
|
||||
{
|
||||
bs->set(bit, bs->test(bit) ^ value);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator-=(bool value) // for b[i] -= x
|
||||
{
|
||||
if (!value)
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator=(const reference& j) // for b[i] = b[j]
|
||||
{
|
||||
@@ -114,34 +128,34 @@ public:
|
||||
bs->set(bit);
|
||||
else
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator|=(const reference& j) // for b[i] |= b[j]
|
||||
{
|
||||
if (j.bs->test(j.bit))
|
||||
bs->set(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator&=(const reference& j) // for b[i] &= b[j]
|
||||
{
|
||||
if (! (j.bs->test(j.bit) && bs->test(bit)))
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator^=(const reference& j) // for b[i] ^= b[j]
|
||||
{
|
||||
bs->set(bit, bs->test(bit) ^ j.bs->test(j.bit));
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
reference& operator-=(const reference& j) // for b[i] -= b[j]
|
||||
{
|
||||
if (!j.bs->test(j.bit))
|
||||
bs->reset(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
bool operator~() const // flips the bit
|
||||
{
|
||||
return ! bs->test(bit);
|
||||
return ! bs->test(bit);
|
||||
}
|
||||
operator bool() const // for x = b[i]
|
||||
{
|
||||
@@ -150,7 +164,7 @@ public:
|
||||
reference& flip() // for b[i].flip();
|
||||
{
|
||||
bs->flip(bit);
|
||||
return *this;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
typedef bool const_reference;
|
||||
@@ -164,21 +178,23 @@ public:
|
||||
const Allocator& alloc = Allocator());
|
||||
|
||||
// from string
|
||||
#if defined(BOOST_OLD_IOSTREAMS) || defined(__BORLANDC__)
|
||||
#if defined(BOOST_OLD_IOSTREAMS)
|
||||
explicit
|
||||
dynamic_bitset(const std::string& s,
|
||||
std::string::size_type pos = 0,
|
||||
std::string::size_type pos = 0,
|
||||
std::string::size_type n = std::string::npos,
|
||||
const Allocator& alloc = Allocator())
|
||||
: detail::dynamic_bitset_base<Block, Allocator>
|
||||
(std::min(n, s.size() - pos), alloc)
|
||||
#else
|
||||
// The parenthesis around std::basic_string<CharT, Traits, Alloc>::npos
|
||||
// in the code below are to avoid a g++ 3.2 bug and a Borland bug. -JGS
|
||||
template <typename CharT, typename Traits, typename Alloc>
|
||||
explicit
|
||||
dynamic_bitset(const std::basic_string<CharT, Traits, Alloc>& s,
|
||||
typename std::basic_string<CharT, Traits, Alloc>::size_type pos = 0,
|
||||
typename std::basic_string<CharT, Traits, Alloc>::size_type n
|
||||
= std::basic_string<CharT, Traits, Alloc>::npos,
|
||||
dynamic_bitset(const std::basic_string<CharT, Traits, Alloc>& s,
|
||||
typename std::basic_string<CharT, Traits, Alloc>::size_type pos = 0,
|
||||
typename std::basic_string<CharT, Traits, Alloc>::size_type n
|
||||
= (std::basic_string<CharT, Traits, Alloc>::npos),
|
||||
const Allocator& alloc = Allocator())
|
||||
: detail::dynamic_bitset_base<Block, Allocator>
|
||||
(std::min(n, s.size() - pos), alloc)
|
||||
@@ -186,7 +202,7 @@ public:
|
||||
{
|
||||
// Locate sub string
|
||||
assert(pos <= s.length());
|
||||
from_string(s, pos, std::min(n, s.size() - pos));
|
||||
from_string(s, pos, std::min(n, s.size() - pos));
|
||||
}
|
||||
|
||||
// The first bit in *first is the least significant bit, and the
|
||||
@@ -195,8 +211,8 @@ public:
|
||||
dynamic_bitset(BlockInputIterator first, BlockInputIterator last,
|
||||
const Allocator& alloc = Allocator())
|
||||
: detail::dynamic_bitset_base<Block, Allocator>
|
||||
(detail::initial_num_blocks(first, last)
|
||||
* bits_per_block, alloc)
|
||||
(detail::initial_num_blocks(first, last)
|
||||
* bits_per_block, alloc)
|
||||
{
|
||||
if (first != last) {
|
||||
if (this->m_num_bits == 0) { // dealing with input iterators
|
||||
@@ -206,7 +222,7 @@ public:
|
||||
for (std::size_t i = 0; first != last; ++first, ++i)
|
||||
set_block_(i, *first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +261,7 @@ public:
|
||||
append(*first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +293,7 @@ public:
|
||||
bool operator[](size_type pos) const { return test_(pos); } //[gps]
|
||||
|
||||
unsigned long to_ulong() const;
|
||||
|
||||
|
||||
size_type size() const;
|
||||
size_type num_blocks() const;
|
||||
|
||||
@@ -288,23 +304,26 @@ public:
|
||||
#ifdef BOOST_DYN_BITSET_USE_FRIENDS
|
||||
// lexicographical comparison
|
||||
template <typename B, typename A>
|
||||
friend bool operator==(const dynamic_bitset<B, A>& a,
|
||||
friend bool operator==(const dynamic_bitset<B, A>& a,
|
||||
const dynamic_bitset<B, A>& b);
|
||||
template <typename B, typename A>
|
||||
friend bool operator<(const dynamic_bitset<B, A>& a,
|
||||
friend bool operator<(const dynamic_bitset<B, A>& a,
|
||||
const dynamic_bitset<B, A>& b);
|
||||
template <typename B, typename A>
|
||||
friend bool operator>(const dynamic_bitset<B, A>& a,
|
||||
friend bool operator>(const dynamic_bitset<B, A>& a,
|
||||
const dynamic_bitset<B, A>& b);
|
||||
|
||||
template <typename B, typename A, typename BlockOutputIterator>
|
||||
friend void to_block_range(const dynamic_bitset<B, A>& b,
|
||||
friend void to_block_range(const dynamic_bitset<B, A>& b,
|
||||
BlockOutputIterator result);
|
||||
|
||||
template <typename B, typename A, typename CharT, typename Alloc>
|
||||
friend void dump_to_string(const dynamic_bitset<B, A>& b,
|
||||
std::basic_string<CharT, Alloc>& s);
|
||||
template <typename BlockIterator, typename B, typename A>
|
||||
friend void from_block_range(BlockIterator first, BlockIterator last,
|
||||
dynamic_bitset<B, A>& result);
|
||||
|
||||
template <typename B, typename A, typename CharT, typename Alloc>
|
||||
friend void dump_to_string(const dynamic_bitset<B, A>& b,
|
||||
std::basic_string<CharT, Alloc>& s);
|
||||
#endif
|
||||
|
||||
private:
|
||||
@@ -328,20 +347,12 @@ public:
|
||||
|
||||
// Assumes string contains only 0's and 1's
|
||||
for (size_type i = 0; i < tot; ++i) {
|
||||
if (s[pos + tot - i - 1] == '1') {
|
||||
if (s[pos + tot - i - 1] == '1') {
|
||||
set_(i);
|
||||
} else {
|
||||
assert(s[pos + tot - i - 1] == '0');
|
||||
assert(s[pos + tot - i - 1] == '0');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename BlockIterator>
|
||||
void from_block_range(BlockIterator first, BlockIterator last)
|
||||
{
|
||||
// PRE: distance(first, last) == size() / bits_per_block
|
||||
for (size_type i = 0; first != last; ++first, ++i)
|
||||
this->m_bits[i] = *first;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
@@ -350,25 +361,25 @@ public:
|
||||
|
||||
// comparison
|
||||
template <typename Block, typename Allocator>
|
||||
bool operator!=(const dynamic_bitset<Block, Allocator>& a,
|
||||
bool operator!=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
bool operator<=(const dynamic_bitset<Block, Allocator>& a,
|
||||
bool operator<=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
bool operator>(const dynamic_bitset<Block, Allocator>& a,
|
||||
bool operator>(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
bool operator>=(const dynamic_bitset<Block, Allocator>& a,
|
||||
bool operator>=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
// stream operators
|
||||
#ifdef BOOST_OLD_IOSTREAMS
|
||||
template <typename Block, typename Allocator>
|
||||
std::ostream& operator<<(std::ostream& os,
|
||||
std::ostream& operator<<(std::ostream& os,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
@@ -376,24 +387,24 @@ std::istream& operator>>(std::istream& is, dynamic_bitset<Block,Allocator>& b);
|
||||
#else
|
||||
template <typename CharT, typename Traits, typename Block, typename Allocator>
|
||||
std::basic_ostream<CharT, Traits>&
|
||||
operator<<(std::basic_ostream<CharT, Traits>& os,
|
||||
operator<<(std::basic_ostream<CharT, Traits>& os,
|
||||
const dynamic_bitset<Block, Allocator>& b);
|
||||
|
||||
template <typename CharT, typename Traits, typename Block, typename Allocator>
|
||||
std::basic_istream<CharT, Traits>&
|
||||
operator>>(std::basic_istream<CharT, Traits>& is,
|
||||
operator>>(std::basic_istream<CharT, Traits>& is,
|
||||
dynamic_bitset<Block, Allocator>& b);
|
||||
#endif
|
||||
|
||||
// bitset operations
|
||||
template <typename Block, typename Allocator>
|
||||
dynamic_bitset<Block, Allocator>
|
||||
operator&(const dynamic_bitset<Block, Allocator>& b1,
|
||||
operator&(const dynamic_bitset<Block, Allocator>& b1,
|
||||
const dynamic_bitset<Block, Allocator>& b2);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
dynamic_bitset<Block, Allocator>
|
||||
operator|(const dynamic_bitset<Block, Allocator>& b1,
|
||||
operator|(const dynamic_bitset<Block, Allocator>& b1,
|
||||
const dynamic_bitset<Block, Allocator>& b2);
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
@@ -408,16 +419,19 @@ operator-(const dynamic_bitset<Block, Allocator>& b1,
|
||||
|
||||
|
||||
template <typename Block, typename Allocator, typename CharT, typename Alloc>
|
||||
void
|
||||
to_string(const dynamic_bitset<Block, Allocator>& b,
|
||||
void
|
||||
to_string(const dynamic_bitset<Block, Allocator>& b,
|
||||
std::basic_string<CharT, Alloc>& s);
|
||||
|
||||
template <typename Block, typename Allocator, typename BlockOutputIterator>
|
||||
void
|
||||
to_block_range(const dynamic_bitset<Block, Allocator>& b,
|
||||
to_block_range(const dynamic_bitset<Block, Allocator>& b,
|
||||
BlockOutputIterator result);
|
||||
|
||||
|
||||
template <typename BlockIterator, typename B, typename A>
|
||||
inline void
|
||||
from_block_range(BlockIterator first, BlockIterator last,
|
||||
dynamic_bitset<B, A>& result);
|
||||
|
||||
//=============================================================================
|
||||
// dynamic_bitset implementation
|
||||
@@ -425,7 +439,7 @@ to_block_range(const dynamic_bitset<Block, Allocator>& b,
|
||||
#ifdef BOOST_OLD_IOSTREAMS
|
||||
template <typename Block, typename Allocator>
|
||||
inline std::ostream&
|
||||
operator<<(std::ostream& os,
|
||||
operator<<(std::ostream& os,
|
||||
const typename dynamic_bitset<Block, Allocator>::reference& br)
|
||||
{
|
||||
return os << (bool)br;
|
||||
@@ -433,7 +447,7 @@ operator<<(std::ostream& os,
|
||||
#else
|
||||
template <typename CharT, typename Traits, typename Block, typename Allocator>
|
||||
inline std::basic_ostream<CharT, Traits>&
|
||||
operator<<(std::basic_ostream<CharT, Traits>& os,
|
||||
operator<<(std::basic_ostream<CharT, Traits>& os,
|
||||
const typename dynamic_bitset<Block, Allocator>::reference& br)
|
||||
{
|
||||
return os << (bool)br;
|
||||
@@ -497,11 +511,7 @@ resize(size_type num_bits, bool value)
|
||||
if (num_bits == size())
|
||||
return;
|
||||
size_type new_nblocks = this->calc_num_blocks(num_bits);
|
||||
#if (defined(_MSC_VER) && (_MSC_VER <= 1300)) || !defined(_CPPLIB_VER) || (_CPPLIB_VER < 306) // Dinkumware for VC6/7
|
||||
Block* d = this->m_alloc.allocate(new_nblocks, 0);
|
||||
#else
|
||||
Block* d = this->m_alloc.allocate(new_nblocks);
|
||||
#endif
|
||||
Block* d = this->m_alloc.allocate(new_nblocks, static_cast<void const *>(0));
|
||||
if (num_bits < size()) { // shrink
|
||||
std::copy(this->m_bits, this->m_bits + new_nblocks, d);
|
||||
std::swap(d, this->m_bits);
|
||||
@@ -637,9 +647,9 @@ dynamic_bitset<Block, Allocator>::operator<<=(size_type n)
|
||||
size_type const last = this->m_num_blocks - 1; // m_num_blocks is >= 1
|
||||
size_type const div = n / bits_per_block; // div is <= last
|
||||
size_type const r = n % bits_per_block;
|
||||
|
||||
|
||||
// PRE: div != 0 or r != 0
|
||||
|
||||
|
||||
if (r != 0) {
|
||||
|
||||
block_type const rs = bits_per_block - r;
|
||||
@@ -648,7 +658,7 @@ dynamic_bitset<Block, Allocator>::operator<<=(size_type n)
|
||||
this->m_bits[i+div] = (this->m_bits[i] << r) | (this->m_bits[i-1] >> rs);
|
||||
}
|
||||
this->m_bits[div] = this->m_bits[0] << r;
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
for (size_type i = last-div; i>0; --i) {
|
||||
@@ -656,12 +666,12 @@ dynamic_bitset<Block, Allocator>::operator<<=(size_type n)
|
||||
}
|
||||
this->m_bits[div] = this->m_bits[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// div blocks are zero filled at the less significant end
|
||||
std::fill(m_bits, m_bits+div, static_cast<block_type>(0));
|
||||
|
||||
|
||||
std::fill(this->m_bits, this->m_bits+div, static_cast<block_type>(0));
|
||||
|
||||
|
||||
}
|
||||
|
||||
return *this;
|
||||
@@ -684,7 +694,7 @@ dynamic_bitset<Block, Allocator>::operator>>=(size_type n)
|
||||
size_type i;
|
||||
for (i = 0; i < this->m_num_bits - n; ++i)
|
||||
set_(i,test_(i+n));
|
||||
|
||||
|
||||
for (i = this->m_num_bits - n; i < this->m_num_bits; ++i)
|
||||
reset_(i);
|
||||
}
|
||||
@@ -697,7 +707,7 @@ dynamic_bitset<Block, Allocator>::operator>>=(size_type n)
|
||||
// NOTE: this assumes that within a single block bits are
|
||||
// numbered from right to left. G.P.S.
|
||||
//
|
||||
// static Block offset(size_type bit)
|
||||
// static Block offset(size_type bit)
|
||||
// { return bit % bits_per_block; }
|
||||
//
|
||||
//
|
||||
@@ -718,7 +728,7 @@ dynamic_bitset<B, A> & dynamic_bitset<B, A>::operator>>=(size_type n) {
|
||||
size_type const last = this->m_num_blocks - 1; // m_num_blocks is >= 1
|
||||
size_type const div = n / bits_per_block; // div is <= last
|
||||
size_type const r = n % bits_per_block;
|
||||
|
||||
|
||||
// PRE: div != 0 or r != 0
|
||||
|
||||
if (r != 0) {
|
||||
@@ -726,22 +736,22 @@ dynamic_bitset<B, A> & dynamic_bitset<B, A>::operator>>=(size_type n) {
|
||||
block_type const ls = bits_per_block - r;
|
||||
|
||||
for (size_type i = div; i < last; ++i) {
|
||||
m_bits[i-div] = (m_bits[i] >> r) | (m_bits[i+1] << ls);
|
||||
this->m_bits[i-div] = (this->m_bits[i] >> r) | (this->m_bits[i+1] << ls);
|
||||
}
|
||||
// r bits go to zero
|
||||
m_bits[last-div] = m_bits[last] >> r;
|
||||
this->m_bits[last-div] = this->m_bits[last] >> r;
|
||||
}
|
||||
|
||||
else {
|
||||
for (size_type i = div; i <= last; ++i) {
|
||||
m_bits[i-div] = m_bits[i];
|
||||
this->m_bits[i-div] = this->m_bits[i];
|
||||
}
|
||||
// note the '<=': the last iteration 'absorbs'
|
||||
// m_bits[last-div] = m_bits[last] >> 0;
|
||||
// this->m_bits[last-div] = this->m_bits[last] >> 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// div blocks are zero filled at the most significant end
|
||||
std::fill(this->m_bits+(this->m_num_blocks-div), this->m_bits+this->m_num_blocks, static_cast<block_type>(0));
|
||||
}
|
||||
@@ -884,7 +894,7 @@ dynamic_bitset<Block, Allocator>::count() const
|
||||
}
|
||||
|
||||
The actual algorithm used is based on using a lookup
|
||||
table.
|
||||
table.
|
||||
|
||||
|
||||
The basic idea of the method is to pick up X bits at a time
|
||||
@@ -892,7 +902,7 @@ table.
|
||||
the binary representation of a number N. Then, to use a table
|
||||
of 1<<X elements where table[N] is the number of '1' digits
|
||||
in the binary representation of N (i.e. in our X bits).
|
||||
|
||||
|
||||
Note that the table can be oversized (i.e. can even have more
|
||||
than 1<<X elements; in that case only the first 1<<X will be
|
||||
actually used) but it cannot be undersized.
|
||||
@@ -921,7 +931,7 @@ dynamic_bitset<Block, Allocator>::count() const
|
||||
using detail::byte_t;
|
||||
|
||||
const byte_t * p = reinterpret_cast<const byte_t*>(this->m_bits);
|
||||
const byte_t * past_end = p + m_num_blocks * sizeof(Block);
|
||||
const byte_t * past_end = p + this->m_num_blocks * sizeof(Block);
|
||||
|
||||
size_type num = 0;
|
||||
unsigned int const max_bit = detail::count<>::max_bit;
|
||||
@@ -941,7 +951,7 @@ dynamic_bitset<Block, Allocator>::count() const
|
||||
do {
|
||||
num += detail::count<>::table[value & ((1<<max_bit)-1)];
|
||||
} while (value >>= max_bit);
|
||||
|
||||
|
||||
++p;
|
||||
}
|
||||
}
|
||||
@@ -956,8 +966,8 @@ dynamic_bitset<Block, Allocator>::count() const
|
||||
|
||||
// take as ref param instead?
|
||||
template <typename Block, typename Allocator, typename CharT, typename Alloc>
|
||||
void
|
||||
to_string(const dynamic_bitset<Block, Allocator>& b,
|
||||
void
|
||||
to_string(const dynamic_bitset<Block, Allocator>& b,
|
||||
std::basic_string<CharT, Alloc>& s)
|
||||
{
|
||||
s.assign(b.size(), '0');
|
||||
@@ -972,38 +982,45 @@ to_string(const dynamic_bitset<Block, Allocator>& b,
|
||||
// for debugging purposes)
|
||||
//
|
||||
template <typename B, typename A, typename CharT, typename Alloc>
|
||||
void
|
||||
dump_to_string(const dynamic_bitset<B, A>& b,
|
||||
void
|
||||
dump_to_string(const dynamic_bitset<B, A>& b,
|
||||
std::basic_string<CharT, Alloc>& s)
|
||||
{
|
||||
std::size_t const len = b.m_num_blocks * (dynamic_bitset<B, A>::bits_per_block);
|
||||
s.assign(len, '0');
|
||||
for (std::size_t i = 0; i != len; ++i)
|
||||
if (b.test_(i))
|
||||
if (b[i])// could use test_ here, but we have friend issues.-JGS
|
||||
s[len - 1 - i] = '1';
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator, typename BlockOutputIterator>
|
||||
void
|
||||
to_block_range(const dynamic_bitset<Block, Allocator>& b,
|
||||
to_block_range(const dynamic_bitset<Block, Allocator>& b,
|
||||
BlockOutputIterator result)
|
||||
{
|
||||
|
||||
//std::copy(m.m_bits, m.m_num_bits, result);
|
||||
//[gps] Did you mean this?
|
||||
std::copy (b.m_bits, b.m_bits + b.m_num_bits, result);
|
||||
assert(b.size() != 0 || b.num_blocks() == 0);
|
||||
std::copy (b.m_bits, b.m_bits + b.m_num_blocks, result);
|
||||
}
|
||||
|
||||
template <typename BlockIterator, typename B, typename A>
|
||||
inline void
|
||||
from_block_range(BlockIterator first, BlockIterator last,
|
||||
dynamic_bitset<B, A>& result)
|
||||
{
|
||||
// PRE: distance(first, last) == numblocks()
|
||||
std::copy (first, last, result.m_bits);
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
unsigned long dynamic_bitset<Block, Allocator>::
|
||||
to_ulong() const
|
||||
to_ulong() const
|
||||
{
|
||||
const std::overflow_error
|
||||
overflow("boost::bit_set::operator unsigned long()");
|
||||
|
||||
if (this->m_num_blocks == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
if (sizeof(Block) >= sizeof(unsigned long)) {
|
||||
for (size_type i = 1; i < this->m_num_blocks; ++i)
|
||||
if (this->m_bits[i])
|
||||
@@ -1087,7 +1104,7 @@ is_proper_subset_of(const dynamic_bitset<Block, Allocator>& a) const
|
||||
// comparison
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
bool operator==(const dynamic_bitset<Block, Allocator>& a,
|
||||
bool operator==(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b)
|
||||
{
|
||||
using namespace std;
|
||||
@@ -1097,7 +1114,7 @@ bool operator==(const dynamic_bitset<Block, Allocator>& a,
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
inline bool operator!=(const dynamic_bitset<Block, Allocator>& a,
|
||||
inline bool operator!=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b)
|
||||
{
|
||||
return !(a == b);
|
||||
@@ -1130,14 +1147,14 @@ bool operator<(const dynamic_bitset<Block, Allocator>& a,
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
inline bool operator<=(const dynamic_bitset<Block, Allocator>& a,
|
||||
inline bool operator<=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b)
|
||||
{
|
||||
return !(a > b);
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
inline bool operator>(const dynamic_bitset<Block, Allocator>& a,
|
||||
inline bool operator>(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b)
|
||||
{
|
||||
assert(a.size() == b.size());
|
||||
@@ -1163,7 +1180,7 @@ inline bool operator>(const dynamic_bitset<Block, Allocator>& a,
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
inline bool operator>=(const dynamic_bitset<Block, Allocator>& a,
|
||||
inline bool operator>=(const dynamic_bitset<Block, Allocator>& a,
|
||||
const dynamic_bitset<Block, Allocator>& b)
|
||||
{
|
||||
return !(a < b);
|
||||
@@ -1267,7 +1284,7 @@ operator>>(std::basic_istream<CharT, Traits>& in_stream,
|
||||
} else {
|
||||
char c2 = Traits::to_char_type(c1);
|
||||
char c = in_stream.narrow(c2, '*');
|
||||
|
||||
|
||||
if (c == '0' || c == '1')
|
||||
tmp += c; // old dinkumware basic_string missing push_back
|
||||
else if (Traits::eq_int_type(read_buf->sputbackc(c2), Traits::eof()))
|
||||
@@ -1277,7 +1294,7 @@ operator>>(std::basic_istream<CharT, Traits>& in_stream,
|
||||
}
|
||||
}
|
||||
} // for
|
||||
|
||||
|
||||
if (tmp.empty()) // did not read in enough bits
|
||||
in_stream.setstate(std::ios_base::failbit);
|
||||
else
|
||||
@@ -1342,13 +1359,7 @@ template <typename Block, typename Allocator>
|
||||
inline void dynamic_bitset<Block, Allocator>::
|
||||
set_block_(size_type blocknum, Block value)
|
||||
{
|
||||
/*for (std::size_t i = 0; i < bits_per_block; ++i, value >>= 1)
|
||||
if (value & 0x1) {
|
||||
size_type bit = blocknum * bits_per_block + i;
|
||||
set_(bit);
|
||||
}*/
|
||||
// [gps]
|
||||
m_bits[blocknum] = value;
|
||||
this->m_bits[blocknum] = value;
|
||||
}
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
@@ -1383,13 +1394,13 @@ bool dynamic_bitset<Block, Allocator>::set_(size_type n, bool value)
|
||||
template <typename Block, typename Allocator>
|
||||
inline void dynamic_bitset<Block, Allocator>::m_zero_unused_bits()
|
||||
{
|
||||
assert (m_num_blocks == this->calc_num_blocks(m_num_bits));
|
||||
assert (this->m_num_blocks == this->calc_num_blocks(this->m_num_bits));
|
||||
|
||||
// if != 0 this is the number of bits used in the last block
|
||||
const size_type used_bits = m_num_bits % bits_per_block;
|
||||
const size_type used_bits = this->m_num_bits % bits_per_block;
|
||||
|
||||
if (used_bits != 0)
|
||||
m_bits[m_num_blocks - 1] &= ~(~static_cast<Block>(0) << used_bits);
|
||||
this->m_bits[this->m_num_blocks - 1] &= ~(~static_cast<Block>(0) << used_bits);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
// (C) Copyright Chuck Allison and Jeremy Siek 2001, 2002.
|
||||
//
|
||||
// Permission to copy, use, modify, sell and distribute this software
|
||||
// is granted provided this copyright notice appears in all
|
||||
// copies. This software is provided "as is" without express or
|
||||
// implied warranty, and with no claim as to its suitability for any
|
||||
// purpose.
|
||||
|
||||
// See http://www.boost.org/libs/dynamic_bitset for documentation.
|
||||
|
||||
#ifndef BOOST_DYNAMIC_BITSET_FWD_HPP
|
||||
#define BOOST_DYNAMIC_BITSET_FWD_HPP
|
||||
|
||||
|
||||
Reference in New Issue
Block a user