mirror of
https://github.com/boostorg/dynamic_bitset.git
synced 2026-01-19 04:12:09 +00:00
Remove a nonsensical typedef
This commit is contained in:
@@ -87,13 +87,11 @@ public:
|
||||
// -----------------------------------------------------------------------
|
||||
typedef std::size_t size_type;
|
||||
|
||||
typedef typename buffer_type::size_type block_width_type;
|
||||
|
||||
//! The number of bits the type `Block` uses to represent
|
||||
//! values, excluding any padding bits. Numerically equal to
|
||||
//! `std::numeric_limits< Block >::digits`.
|
||||
// -----------------------------------------------------------------------
|
||||
BOOST_STATIC_CONSTANT( block_width_type, bits_per_block = ( std::numeric_limits< Block >::digits ) );
|
||||
BOOST_STATIC_CONSTANT( int, bits_per_block = ( std::numeric_limits< Block >::digits ) );
|
||||
|
||||
//! The maximum value of `size_type`.
|
||||
// -----------------------------------------------------------------------
|
||||
@@ -182,7 +180,7 @@ public:
|
||||
|
||||
//! The one and only non-copy ctor
|
||||
// -------------------------------------------------------------------
|
||||
reference( block_type & b, block_width_type pos );
|
||||
reference( block_type & b, int pos );
|
||||
|
||||
//! Left undefined.
|
||||
// -------------------------------------------------------------------
|
||||
@@ -1038,7 +1036,7 @@ public:
|
||||
friend class serialize_impl;
|
||||
|
||||
private:
|
||||
BOOST_STATIC_CONSTANT( block_width_type, ulong_width = std::numeric_limits< unsigned long >::digits );
|
||||
BOOST_STATIC_CONSTANT( int, ulong_width = std::numeric_limits< unsigned long >::digits );
|
||||
|
||||
dynamic_bitset & range_operation( size_type pos, size_type len, Block ( *partial_block_operation )( Block, size_type, size_type ), Block ( *full_block_operation )( Block ) );
|
||||
void m_zero_unused_bits();
|
||||
@@ -1047,9 +1045,9 @@ private:
|
||||
static bool m_not_empty( Block x );
|
||||
size_type m_do_find_from( size_type first_block ) const;
|
||||
|
||||
block_width_type count_extra_bits() const BOOST_NOEXCEPT;
|
||||
int count_extra_bits() const BOOST_NOEXCEPT;
|
||||
static size_type block_index( size_type pos ) BOOST_NOEXCEPT;
|
||||
static block_width_type bit_index( size_type pos ) BOOST_NOEXCEPT;
|
||||
static int bit_index( size_type pos ) BOOST_NOEXCEPT;
|
||||
static Block bit_mask( size_type pos ) BOOST_NOEXCEPT;
|
||||
static Block bit_mask( size_type first, size_type last ) BOOST_NOEXCEPT;
|
||||
static Block set_block_bits( Block block, size_type first, size_type last, bool val ) BOOST_NOEXCEPT;
|
||||
@@ -1127,7 +1125,7 @@ private:
|
||||
#if ! defined BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
const typename dynamic_bitset< Block, Allocator >::block_width_type
|
||||
const int
|
||||
dynamic_bitset< Block, Allocator >::bits_per_block;
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
@@ -1135,7 +1133,7 @@ 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
|
||||
const int
|
||||
dynamic_bitset< Block, Allocator >::ulong_width;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
namespace boost {
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
dynamic_bitset< Block, Allocator >::reference::reference( block_type & b, block_width_type pos )
|
||||
dynamic_bitset< Block, Allocator >::reference::reference( block_type & b, int pos )
|
||||
: m_block( b ), m_mask( ( BOOST_ASSERT( pos < bits_per_block ), block_type( 1 ) << pos ) )
|
||||
{
|
||||
}
|
||||
@@ -292,7 +292,7 @@ dynamic_bitset< Block, Allocator >::
|
||||
// they must be set.
|
||||
|
||||
if ( value && ( num_bits > m_num_bits ) ) {
|
||||
const block_width_type extra_bits = count_extra_bits();
|
||||
const int extra_bits = count_extra_bits();
|
||||
if ( extra_bits ) {
|
||||
BOOST_ASSERT( old_num_blocks >= 1 && old_num_blocks <= m_bits.size() );
|
||||
|
||||
@@ -345,7 +345,7 @@ void
|
||||
dynamic_bitset< Block, Allocator >::
|
||||
append( Block value ) // strong guarantee
|
||||
{
|
||||
const block_width_type r = count_extra_bits();
|
||||
const int r = count_extra_bits();
|
||||
|
||||
if ( r == 0 ) {
|
||||
// the buffer is empty, or all blocks are filled
|
||||
@@ -430,11 +430,11 @@ dynamic_bitset< Block, Allocator >::operator<<=( size_type n )
|
||||
if ( n > 0 ) {
|
||||
const size_type last = num_blocks() - 1; // num_blocks() is >= 1
|
||||
const size_type div = n / bits_per_block; // div is <= last
|
||||
const block_width_type r = bit_index( n );
|
||||
const int r = bit_index( n );
|
||||
block_type * const b = &m_bits[ 0 ];
|
||||
|
||||
if ( r != 0 ) {
|
||||
const block_width_type rs = bits_per_block - r;
|
||||
const int rs = bits_per_block - r;
|
||||
|
||||
for ( size_type i = last - div; i > 0; --i ) {
|
||||
b[ i + div ] = ( b[ i ] << r ) | ( b[ i - 1 ] >> rs );
|
||||
@@ -473,11 +473,11 @@ dynamic_bitset< B, A >::operator>>=( size_type n )
|
||||
if ( n > 0 ) {
|
||||
const size_type last = num_blocks() - 1; // num_blocks() is >= 1
|
||||
const size_type div = n / bits_per_block; // div is <= last
|
||||
const block_width_type r = bit_index( n );
|
||||
const int r = bit_index( n );
|
||||
block_type * const b = &m_bits[ 0 ];
|
||||
|
||||
if ( r != 0 ) {
|
||||
const block_width_type ls = bits_per_block - r;
|
||||
const int ls = bits_per_block - r;
|
||||
|
||||
for ( size_type i = div; i < last; ++i ) {
|
||||
b[ i - div ] = ( b[ i ] >> r ) | ( b[ i + 1 ] << ls );
|
||||
@@ -650,7 +650,7 @@ dynamic_bitset< Block, Allocator >::all() const
|
||||
return true;
|
||||
}
|
||||
|
||||
const block_width_type extra_bits = count_extra_bits();
|
||||
const int extra_bits = count_extra_bits();
|
||||
const block_type all_ones = detail::dynamic_bitset_impl::max_limit< Block >::value;
|
||||
|
||||
if ( extra_bits == 0 ) {
|
||||
@@ -934,7 +934,7 @@ dynamic_bitset< Block, Allocator >::find_first( size_type pos ) const
|
||||
return npos;
|
||||
|
||||
const size_type blk = block_index( pos );
|
||||
const block_width_type ind = bit_index( pos );
|
||||
const int ind = bit_index( pos );
|
||||
|
||||
// shift bits upto one immediately after current
|
||||
const Block fore = m_bits[ blk ] >> ind;
|
||||
@@ -1374,7 +1374,7 @@ dynamic_bitset< Block, Allocator >::m_zero_unused_bits()
|
||||
BOOST_ASSERT( num_blocks() == calc_num_blocks( m_num_bits ) );
|
||||
|
||||
// if != 0, this is the number of bits used in the last block.
|
||||
const block_width_type extra_bits = count_extra_bits();
|
||||
const int extra_bits = count_extra_bits();
|
||||
|
||||
if ( extra_bits != 0 )
|
||||
m_highest_block() &= ( Block( 1 ) << extra_bits ) - 1;
|
||||
@@ -1385,7 +1385,7 @@ template< typename Block, typename Allocator >
|
||||
bool
|
||||
dynamic_bitset< Block, Allocator >::m_check_invariants() const
|
||||
{
|
||||
const block_width_type extra_bits = count_extra_bits();
|
||||
const int extra_bits = count_extra_bits();
|
||||
if ( extra_bits > 0 ) {
|
||||
const block_type mask = detail::dynamic_bitset_impl::max_limit< Block >::value << extra_bits;
|
||||
if ( ( m_highest_block() & mask ) != 0 )
|
||||
@@ -1405,7 +1405,7 @@ dynamic_bitset< Block, Allocator >::m_not_empty( Block x )
|
||||
}
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
typename dynamic_bitset< Block, Allocator >::block_width_type
|
||||
int
|
||||
dynamic_bitset< Block, Allocator >::count_extra_bits() const BOOST_NOEXCEPT
|
||||
{
|
||||
return bit_index( size() );
|
||||
@@ -1419,10 +1419,10 @@ dynamic_bitset< Block, Allocator >::block_index( size_type pos ) BOOST_NOEXCEPT
|
||||
}
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
typename dynamic_bitset< Block, Allocator >::block_width_type
|
||||
int
|
||||
dynamic_bitset< Block, Allocator >::bit_index( size_type pos ) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast< block_width_type >( pos % bits_per_block );
|
||||
return static_cast< int >( pos % bits_per_block );
|
||||
}
|
||||
|
||||
template< typename Block, typename Allocator >
|
||||
@@ -1622,7 +1622,7 @@ void
|
||||
dynamic_bitset< Block, Allocator >::m_append( BlockInputIterator first, BlockInputIterator last, std::forward_iterator_tag )
|
||||
{
|
||||
BOOST_ASSERT( first != last );
|
||||
block_width_type r = count_extra_bits();
|
||||
int r = count_extra_bits();
|
||||
std::size_t d = std::distance( first, last );
|
||||
m_bits.reserve( num_blocks() + d );
|
||||
if ( r == 0 ) {
|
||||
@@ -1654,7 +1654,7 @@ dynamic_bitset< Block, Allocator >::bit_appender::~bit_appender()
|
||||
// resize.
|
||||
//
|
||||
std::reverse( bs.m_bits.begin(), bs.m_bits.end() );
|
||||
const block_width_type offs = bit_index( n );
|
||||
const int offs = bit_index( n );
|
||||
if ( offs )
|
||||
bs >>= ( bits_per_block - offs );
|
||||
bs.resize( n ); // doesn't enlarge, so can't throw
|
||||
|
||||
@@ -223,8 +223,7 @@ struct bitset_test
|
||||
|
||||
typename std::vector< Block >::const_iterator p = v.begin() + offset;
|
||||
for ( size_type n = 0; n < b.num_blocks(); ++n, ++p ) {
|
||||
typename Bitset::block_width_type i = 0;
|
||||
for ( ; i < bits_per_block; ++i ) {
|
||||
for ( int i = 0; i < bits_per_block; ++i ) {
|
||||
size_type bit = n * bits_per_block + i;
|
||||
BOOST_TEST( nth_bit( *p, i ) == ( bit < b.size() ? b[ bit ] : 0 ) );
|
||||
}
|
||||
@@ -241,8 +240,7 @@ struct bitset_test
|
||||
Bitset bset( blocks.begin(), blocks.end() );
|
||||
std::size_t n = blocks.size();
|
||||
for ( std::size_t b = 0; b < n; ++b ) {
|
||||
typename Bitset::block_width_type i = 0;
|
||||
for ( ; i < bits_per_block; ++i ) {
|
||||
for ( int i = 0; i < bits_per_block; ++i ) {
|
||||
std::size_t bit = b * bits_per_block + i;
|
||||
BOOST_TEST( bset[ bit ] == nth_bit( blocks[ b ], i ) );
|
||||
}
|
||||
@@ -254,8 +252,7 @@ struct bitset_test
|
||||
Bitset bset( n * bits_per_block );
|
||||
boost::from_block_range( blocks.begin(), blocks.end(), bset );
|
||||
for ( std::size_t b = 0; b < n; ++b ) {
|
||||
typename Bitset::block_width_type i = 0;
|
||||
for ( ; i < bits_per_block; ++i ) {
|
||||
for ( int i = 0; i < bits_per_block; ++i ) {
|
||||
std::size_t bit = b * bits_per_block + i;
|
||||
BOOST_TEST( bset[ bit ] == nth_bit( blocks[ b ], i ) );
|
||||
}
|
||||
@@ -424,7 +421,7 @@ struct bitset_test
|
||||
Block value( 128 );
|
||||
b.append( value );
|
||||
BOOST_TEST( b.size() == lhs.size() + bits_per_block );
|
||||
for ( typename Bitset::block_width_type i = 0; i < bits_per_block; ++i )
|
||||
for ( int i = 0; i < bits_per_block; ++i )
|
||||
BOOST_TEST( b[ lhs.size() + i ] == bool( ( value >> i ) & 1 ) );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user