Я не уверен, указано ли в стандарте, что продвижение/разыменование стандартного итератора контейнера не является исключением. GCC и MSVC последовательно исключают их для всех стандартных контейнеров. Но clang делает их noException для std::vector/std::basic_string и noException(false) для std::list/std::set/std::map/std::unordered_set/std::unordered_map.
Пример кода можно найти ниже или на сайте godbolt.
#include
#include
#include
#include
#include
#include
#include
#include
template
concept nothrow_advancable = noexcept(++std::declval());
template
concept nothrow_dereferencable = noexcept(*std::declval());
static_assert(nothrow_advancable);
static_assert(nothrow_advancable);
static_assert(nothrow_advancable); // not noexcept with clang
static_assert(nothrow_advancable); // not noexcept with clang
static_assert(nothrow_advancable); // not noexcept with clang
static_assert(nothrow_advancable); // not noexcept with clang
static_assert(nothrow_advancable); // not noexcept with clang
static_assert(nothrow_dereferencable);
static_assert(nothrow_dereferencable);
static_assert(nothrow_dereferencable); // not noexcept with clang
static_assert(nothrow_dereferencable); // not noexcept with clang
static_assert(nothrow_dereferencable); // not noexcept with clang
static_assert(nothrow_dereferencable); // not noexcept with clang
static_assert(nothrow_dereferencable); // not noexcept with clang
Подробнее здесь: https://stackoverflow.com/questions/793 ... containers
Почему clang несовместим с noException(++it) и noException(*it) для контейнеров? ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Почему clang несовместим с noException(++it) и noException(*it) для контейнеров?
Anonymous » » в форуме C++ - 0 Ответы
- 8 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Рекурсивное использование оператора noException компилируется в gcc, но не в clang и msvc.
Anonymous » » в форуме C++ - 0 Ответы
- 26 Просмотры
-
Последнее сообщение Anonymous
-
-
-
MacOS Clang Compiler выпуск (Apple Clang версия 17.0.0 (Clang-1700.0.13.5))))
Anonymous » » в форуме C++ - 0 Ответы
- 10 Просмотры
-
Последнее сообщение Anonymous
-