https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86843

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Hmm, many of the checks in algorithms rely on the fact that the iterators are
Debug Mode iterators (e.g. to check that the end iterator is reachable from the
begin one, or that the iterators are not singular). That means the checks are
not possible without using the Debug Mode containers, which means ABI changes.

These don't depend on debug mode iterators:

// Verify that [_First, _Last) forms a non-empty iterator range.
#define __glibcxx_check_non_empty_range(_First,_Last)                   \

// Verify that the subscript _N is less than the container's size.
#define __glibcxx_check_subscript(_N)                                   \

// Verify that the bucket _N is less than the container's buckets count.
#define __glibcxx_check_bucket_index(_N)                                \
_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(),                        \

// Verify that the container is nonempty
#define __glibcxx_check_nonempty()                                      \
_GLIBCXX_DEBUG_VERIFY(! this->empty(),                                  \

// Verify that load factor is positive
#define __glibcxx_check_max_load_factor(_F)                             \
_GLIBCXX_DEBUG_VERIFY(_F > 0.0f,                                        \

#define __glibcxx_check_equal_allocs(_This, _Other)                     \
_GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(),  \

// Verify that a predicate is irreflexive
#define __glibcxx_check_irreflexive(_First,_Last)                       \
  _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First),        \


It looks like the is_sorted and is_partitioned and is_heap checks could be
enabled too (and they're definitely not OK for _GLIBCXX_ASSERTIONS because they
change the algorithmic complexity).

Reply via email to