Commit Graph

481 Commits

Author SHA1 Message Date
Gennaro Prota
ff1a0fda26 Assert that both the underlying container and dynamic_bitset provide at least bidirectional iterators
The assert uses C++20 concepts, so it is only performed in C++20 or
later.

Note that, while evaluating the concept for the second assert, MSVC 2022
complained a constructor of class reference was private, therefore we
added a friend declaration.
2025-10-15 11:41:43 +02:00
Gennaro Prota
134fab263b Add a missing #include directive 2025-10-15 11:41:43 +02:00
Gennaro Prota
68c5913983 Mark pre-C++11 compilers as unusable for the regression tests 2025-10-15 11:41:43 +02:00
Gennaro Prota
882e0e0665 Remove two superfluous #include directives
This fixes/completes "Remove other workarounds for obsolete compilers".
2025-10-15 11:41:43 +02:00
Gennaro Prota
843b6c3dd0 Fix two typos in two comments 2025-10-15 11:41:43 +02:00
Gennaro Prota
bbb2fa90df Update a comment about library issue 303 2025-10-15 11:41:43 +02:00
Gennaro Prota
15a73050cb Re-apply Clang-Format
We should really automate this. But, for the moment...
2025-10-15 11:41:43 +02:00
Gennaro Prota
ac5df5566a Add two missing const qualifiers 2025-10-15 11:41:43 +02:00
Gennaro Prota
9bba7af0b5 Avoid a redundant first != last check for append< BlockInputIterator >() with input iterators
Note that this also avoids a BOOST_ASSERT().
2025-10-15 11:41:43 +02:00
Gennaro Prota
4cf19a2b0a Fix append< BlockInputIterator >() for input iterators
We were using `AllocatorOrContainer` as if it were still guaranteed to
be an allocator type. Unfortunately, the append() tests didn't exercise
input iterators, so this went unnoticed. I've now added tests.
2025-10-15 11:41:43 +02:00
Gennaro Prota
a740393527 Remove extra parentheses in the implementation of operator<()
Reason: Consistency.
2025-10-15 11:41:43 +02:00
Gennaro Prota
7ae245eabf Add missing spaces in a comment
Reason: Consistency.
2025-10-15 11:41:43 +02:00
Gennaro Prota
9d604eba5a Simplify the implementation of all() 2025-10-15 11:41:43 +02:00
Gennaro Prota
fae55af67d Remove a reference to a removed comment
The referenced comment was removed when porting the documentation to
MrDocs. It advised against using the constructor from basic_string, but,
perhaps, that advice was a bit too strong (constructing from strings is
handy, and probably faster than inputting from a stringstream).
2025-10-15 11:41:43 +02:00
Gennaro Prota
81011d8161 Add trailing periods to the \pre paragraphs that missed them
Reason: Consistency.
2025-10-15 11:41:43 +02:00
Gennaro Prota
51db99cf32 Fix a few documentation glitches 2025-10-15 11:41:43 +02:00
Gennaro Prota
ac6b01140d Make the three "from string" constructors explicit
Making them non-explicit was an oversight.
2025-10-15 11:41:43 +02:00
Gennaro Prota
26dac17a4a Settle the documentation of the iterators
We choose to hide the iterator type definitions and just document their
category, which is enough.
2025-10-15 11:41:43 +02:00
Gennaro Prota
d3c4e2751a Improve the encapsulation of bit_iterator_base 2025-10-15 11:41:43 +02:00
Gennaro Prota
c58487c26a Fix an error in the documentation of operator==() 2025-10-15 11:41:43 +02:00
Gennaro Prota
6f3634aa4b Remove the dependency on core/allocator_access.hpp 2025-10-15 11:41:43 +02:00
Gennaro Prota
d8365ee015 Make the max_size() tests a bit more meaningful 2025-10-15 11:41:43 +02:00
Gennaro Prota
4ca26518ec Add a missing comment 2025-10-15 11:41:43 +02:00
Gennaro Prota
8f07dd356a Add push_front() and pop_front() 2025-10-15 11:41:43 +02:00
Gennaro Prota
efd4d41f60 No longer use BOOST_NO_CXX11_RVALUE_REFERENCES
Reason: We require decent C++11 support anyway.
2025-10-15 11:41:43 +02:00
Gennaro Prota
30ee0f68b5 Add two blank lines
Reason: Readability, consistency.
2025-10-15 11:41:43 +02:00
Gennaro Prota
eba192e3a3 Make the descriptions of the preconditions of the three "from string" constructors more precise 2025-10-15 11:41:43 +02:00
Gennaro Prota
bb489c186a Add a constructor from basic_string_view in C++17 or later
Note that we have MrDocs compile as C++17 again (a change that we had
reverted).
2025-10-15 11:41:43 +02:00
Gennaro Prota
0177f4adfa Add a constructor from const CharT * (pointer to C-style string)
This is in preparation of the next commit, which will add a constructor
from std::basic_string_view (otherwise, construction from a C-style
string would be ambiguous between the basic_string_view and the
basic_string constructor).

Note that, rather than duplicating code to test the new member, we
changed many constructions in dyn_bitset_unit_tests1.cpp to use const
char *, instead of std::string. (The constructor from std::basic_string
is tested separately anyway.)
2025-10-15 11:41:43 +02:00
Gennaro Prota
079cff781d Don't test for Tr::eq( c, one ) twice in init_from_string() 2025-10-15 11:41:43 +02:00
Gennaro Prota
e00d9b30ae No longer use boost::move()
Reason: We require C++11 now, so we can use std::move().
2025-10-15 11:41:43 +02:00
Gennaro Prota
ae9703b119 Actually test the move constructor in the move constructor tests
We were testing the *copy* constructor, instead.
2025-10-15 11:41:43 +02:00
Gennaro Prota
3ccf097dc1 Replace a #include of a deprecated include file 2025-10-15 11:41:43 +02:00
Gennaro Prota
88995c08b0 Remove a superfluous #include directive 2025-10-15 11:41:43 +02:00
Gennaro Prota
3531f6703b Add missing const qualifiers 2025-10-15 11:41:43 +02:00
Gennaro Prota
0ff8509214 Make lowest_bit() more efficient
As a nice bonus, this also removes the dependency on Boost.Integer.
2025-10-15 11:41:43 +02:00
Gennaro Prota
08191fc025 Remove a spurious space 2025-10-15 11:41:43 +02:00
Gennaro Prota
759c4f4e4a Fix a misleading variable name 2025-10-15 11:41:43 +02:00
Gennaro Prota
12dfcea22f Get rid of BOOST_STATIC_ASSERT() and BOOST_STATIC_CONSTANT()
Reason: They are no longer necessary, given that we require C++11 now.
2025-10-15 11:41:43 +02:00
Gennaro Prota
526104dbe9 Assert that Block is the same type as AllocatorOrContainer::value_type
Reason: That's required both when AllocatorOrContainer is an allocator
type and when it's a container type. Now, when it is an allocator type,
the assert is usually in the implementation of std::vector, which we
use. But, when it's a container type, we need to assert that on our own.
2025-10-15 11:41:43 +02:00
Gennaro Prota
b6a875976d Remove the parameter-less overloads of find_first() and find_first_off()
Reason: We can use a default argument, instead, which is what
dynamic_bitset usually does.
2025-10-15 11:41:43 +02:00
Gennaro Prota
394854535a Make pop_back() more efficient 2025-10-15 11:41:43 +02:00
Gennaro Prota
1bef343d12 Back out the support for operator<=> in our iterators
Reason: It required operator<=> for the underlying container, and
boost::container::small_vector doesn't support it.
2025-10-15 11:41:42 +02:00
Gennaro Prota
0ca460971e Make buffer_type public
Reason: Failures from GCC and Clang. See the new code comment.
2025-10-15 11:41:42 +02:00
Gennaro Prota
6747f81566 Remove some outdated macros (workarounds for MSVC 6) 2025-10-15 11:41:42 +02:00
Gennaro Prota
b428ca6365 Remove another workaround for CodeWarrior
Reason: Obsolete compiler.
2025-10-15 11:41:14 +02:00
Gennaro Prota
35b0094529 Add C++20 iterators
Reason: Requested on the mailing list.
2025-10-14 19:24:47 +02:00
Gennaro Prota
1b8ef09564 Allow choosing the underlying container type
The user can now choose the underlying container type used by
dynamic_bitset. This allows e.g. having small buffer optimization by
using boost::container::small_vector.

Since the underlying container is no longer guaranteed to be
std::vector, we revert "Reflect some noexcept specifications of
std::vector in dynamic_bitset" and the related "Let MrDocs compile the
code as C++17".

Note that we didn't add serialization tests (dyn_bitset_unit_tests5.cpp)
because boost::container::small_vector has no serialization support.

This closes issue #76.
2025-10-14 19:24:47 +02:00
Gennaro Prota
e194055264 Add find_first_off(), find_first_off( size_type ) and find_next_off( size_type ) 2025-10-14 19:24:47 +02:00
Gennaro Prota
54b32707c4 Don't repeat the preprocessing condition to specialize std::hash 2025-10-14 19:24:47 +02:00