Почему clang несовместим с noException(++it) и noException(*it) для контейнеров?C++

Программы на C++. Форум разработчиков
Ответить
Anonymous
 Почему clang несовместим с noException(++it) и noException(*it) для контейнеров?

Сообщение Anonymous »

Я не уверен, указано ли в стандарте, что продвижение/разыменование стандартного итератора контейнера не является исключением. 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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «C++»