mirror of
https://github.com/boostorg/dynamic_bitset.git
synced 2026-01-19 04:12:09 +00:00
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.
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "boost/dynamic_bitset_fwd.hpp"
|
||||
#include "boost/limits.hpp"
|
||||
#include <iosfwd>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
@@ -197,6 +198,7 @@ public:
|
||||
class reference
|
||||
{
|
||||
friend class dynamic_bitset< Block, AllocatorOrContainer >;
|
||||
friend class bit_iterator< dynamic_bitset >;
|
||||
|
||||
//! The one and only non-copy ctor
|
||||
// -------------------------------------------------------------------
|
||||
@@ -294,6 +296,11 @@ public:
|
||||
// -----------------------------------------------------------------------
|
||||
typedef std::reverse_iterator< const_iterator > const_reverse_iterator;
|
||||
|
||||
#if __cplusplus >= 202002L
|
||||
static_assert( std::bidirectional_iterator< typename buffer_type::iterator >, "AllocatorOrContainer doesn't provide at least BidirectionalIterators" );
|
||||
static_assert( std::bidirectional_iterator< iterator > );
|
||||
#endif
|
||||
|
||||
//! Constructs a bitset of size zero.
|
||||
//!
|
||||
//! \par Postconditions
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
#include <istream>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
Reference in New Issue
Block a user