mirror of
https://github.com/boostorg/dynamic_bitset.git
synced 2026-01-23 05:32:09 +00:00
Compare commits
8 Commits
boost-1.37
...
boost-1.46
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b241db6ec | ||
|
|
e6fc8e8ec9 | ||
|
|
d77a2c4afa | ||
|
|
e3a2ca7276 | ||
|
|
38819630fd | ||
|
|
6d0f9801f5 | ||
|
|
b7eedd0f46 | ||
|
|
16ca9cbb3c |
@@ -71,8 +71,8 @@ void run_numeric_ctor_tests( BOOST_EXPLICIT_TEMPLATE_TYPE(Tests)
|
||||
};
|
||||
|
||||
const T numbers[] = {
|
||||
T(-1), T(-3), T(-8), T(-15), mi/2, mi,
|
||||
0, 1, 3, 8, 15, ma/2, ma
|
||||
T(-1), T(-3), T(-8), T(-15), T(mi/2), T(mi),
|
||||
T(0), T(1), T(3), T(8), T(15), T(ma/2), T(ma)
|
||||
};
|
||||
|
||||
for (std::size_t s = 0; s < BOOST_BITSET_TEST_COUNT(sizes); ++s) {
|
||||
|
||||
@@ -212,6 +212,7 @@ public:
|
||||
|
||||
bool <a href="#is_subset_of">is_subset_of</a>(const dynamic_bitset& a) const;
|
||||
bool <a href="#is_proper_subset_of">is_proper_subset_of</a>(const dynamic_bitset& a) const;
|
||||
bool <a href="#intersects">intersects</a>(const dynamic_bitset& a) const;
|
||||
|
||||
size_type <a href="#find_first">find_first</a>() const;
|
||||
size_type <a href="#find_next">find_next</a>(size_type pos) const;
|
||||
@@ -1174,6 +1175,19 @@ also set and if <tt>this->count() < a.count()</tt>.
|
||||
Otherwise this function returns false.<br />
|
||||
<b>Throws:</b> nothing.
|
||||
|
||||
<hr />
|
||||
<pre>
|
||||
bool <a id=
|
||||
"intersects">intersects</a>(const dynamic_bitset& a) const
|
||||
</pre>
|
||||
|
||||
<b>Requires:</b> <tt>this->size() == a.size()</tt><br />
|
||||
<b>Returns:</b> true if this bitset and <tt>a</tt> intersect.
|
||||
That is, it returns true if, there is a bit which is set in this
|
||||
bitset, such that the corresponding bit in bitset <tt>a</tt> is
|
||||
also set. Otherwise this function returns false.<br />
|
||||
<b>Throws:</b> nothing.
|
||||
|
||||
<hr />
|
||||
<pre>
|
||||
size_type <a id = "find_first">find_first</a>() const;
|
||||
|
||||
@@ -20,19 +20,13 @@
|
||||
# define BOOST_OLD_IOSTREAMS
|
||||
#endif
|
||||
|
||||
// this should be in the config system some day
|
||||
// see http://lists.boost.org/MailArchives/boost/msg62291.php
|
||||
#define BOOST_DYNAMIC_BITSET_GNUC_VERSION ( (__GNUC__) * 100 * 100 \
|
||||
+ (__GNUC_MINOR__) * 100)
|
||||
|
||||
// no-op function to workaround gcc bug c++/8419
|
||||
//
|
||||
namespace boost { namespace detail {
|
||||
template <typename T> T make_non_const(T t) { return t; }
|
||||
}}
|
||||
|
||||
#if defined(__GNUC__) && BOOST_WORKAROUND(BOOST_DYNAMIC_BITSET_GNUC_VERSION, \
|
||||
BOOST_TESTED_AT(30300))
|
||||
#if defined(__GNUC__)
|
||||
# define BOOST_DYNAMIC_BITSET_WRAP_CONSTANT(expr) \
|
||||
(boost::detail::make_non_const(expr))
|
||||
#else
|
||||
|
||||
@@ -54,7 +54,7 @@ class dynamic_bitset
|
||||
// of VC++ are likely able to digest a more drinking form of the
|
||||
// code; but changing it now is probably not worth the risks...]
|
||||
|
||||
BOOST_STATIC_ASSERT(detail::dynamic_bitset_impl::allowed_block_type<Block>::value);
|
||||
BOOST_STATIC_ASSERT((bool)detail::dynamic_bitset_impl::allowed_block_type<Block>::value);
|
||||
|
||||
public:
|
||||
typedef Block block_type;
|
||||
@@ -476,24 +476,18 @@ BOOST_DYNAMIC_BITSET_PRIVATE:
|
||||
|
||||
};
|
||||
|
||||
#if defined(__IBMCPP__) && BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
#if !defined BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
||||
// Workaround for IBM's AIX platform.
|
||||
// See http://comments.gmane.org/gmane.comp.lib.boost.user/15331
|
||||
//
|
||||
// NOTE:
|
||||
// The compiler is actually right, until core issue 454 will be settled:
|
||||
// <http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_active.html#454>
|
||||
//
|
||||
// It's arguable whether we want to mark this with BOOST_WORKAROUND or not.
|
||||
|
||||
|
||||
template<typename Block, typename Allocator>
|
||||
dynamic_bitset<Block, Allocator>::block_width_type const
|
||||
template <typename Block, typename Allocator>
|
||||
const typename dynamic_bitset<Block, Allocator>::block_width_type
|
||||
dynamic_bitset<Block, Allocator>::bits_per_block;
|
||||
|
||||
template<typename Block, typename Allocator>
|
||||
dynamic_bitset<Block, Allocator>::block_width_type const
|
||||
template <typename Block, typename Allocator>
|
||||
const typename dynamic_bitset<Block, Allocator>::size_type
|
||||
dynamic_bitset<Block, Allocator>::npos;
|
||||
|
||||
template <typename Block, typename Allocator>
|
||||
const typename dynamic_bitset<Block, Allocator>::block_width_type
|
||||
dynamic_bitset<Block, Allocator>::ulong_width;
|
||||
|
||||
#endif
|
||||
@@ -676,7 +670,7 @@ resize(size_type num_bits, bool value) // strong guarantee
|
||||
|
||||
if (value && (num_bits > m_num_bits)) {
|
||||
|
||||
const size_type extra_bits = count_extra_bits();
|
||||
const block_width_type extra_bits = count_extra_bits();
|
||||
if (extra_bits) {
|
||||
assert(old_num_blocks >= 1 && old_num_blocks <= m_bits.size());
|
||||
|
||||
@@ -1005,20 +999,26 @@ dynamic_bitset<Block, Allocator>::count() const
|
||||
using detail::dynamic_bitset_impl::access_by_blocks;
|
||||
using detail::dynamic_bitset_impl::value_to_type;
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ == 3) && (__GNUC_PATCHLEVEL__ == 3)
|
||||
// NOTE: Explicit qualification of "bits_per_block"
|
||||
// breaks compilation on gcc 4.3.3
|
||||
enum { no_padding = bits_per_block == CHAR_BIT * sizeof(Block) };
|
||||
#else
|
||||
// NOTE: Explicitly qualifying "bits_per_block" to workaround
|
||||
// regressions of gcc 3.4.x
|
||||
const bool no_padding =
|
||||
enum { no_padding =
|
||||
dynamic_bitset<Block, Allocator>::bits_per_block
|
||||
== CHAR_BIT * sizeof(Block);
|
||||
== CHAR_BIT * sizeof(Block) };
|
||||
#endif
|
||||
|
||||
const bool enough_table_width = table_width >= CHAR_BIT;
|
||||
enum { enough_table_width = table_width >= CHAR_BIT };
|
||||
|
||||
const bool mode = (no_padding && enough_table_width)
|
||||
enum { mode = (no_padding && enough_table_width)
|
||||
? access_by_bytes
|
||||
: access_by_blocks;
|
||||
: access_by_blocks };
|
||||
|
||||
return do_count(m_bits.begin(), num_blocks(), Block(0),
|
||||
static_cast<value_to_type<mode> *>(0));
|
||||
static_cast<value_to_type<(bool)mode> *>(0));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user