DS
Size: a a a
DS
CD
ПК
AT
circular<int> c{3, 1, 2, 4, 5}; std::sort(std::begin(c), std::next(std::begin(c), c.size()));
, то std::begin(c) == std::next(std::begin(c), c.size())
, т.к. указывают на один и тот же элемент, и, при этом, std::begin(c) < std::next(std::begin(c), c.size())
, т.к. в операторе <
сравниваются эти хитрые индексы (не по модулю). Strict total ordering не выполняется.AT
АР
AT
DS
circular<int> c{3, 1, 2, 4, 5}; std::sort(std::begin(c), std::next(std::begin(c), c.size()));
, то std::begin(c) == std::next(std::begin(c), c.size())
, т.к. указывают на один и тот же элемент, и, при этом, std::begin(c) < std::next(std::begin(c), c.size())
, т.к. в операторе <
сравниваются эти хитрые индексы (не по модулю). Strict total ordering не выполняется.AT
AT
it
и оператор == может быть устроен так template<typename T, typename Container> bool circular<T, Container>::iterator::operator == (iterator other) const { return it == other.it; }
DS
AT
AT
DS
AT
std::array
, но append insert push_fornt/back etc нельзя вызывать у underlying контейнера)AT
AT
it
и оператор == может быть устроен так template<typename T, typename Container> bool circular<T, Container>::iterator::operator == (iterator other) const { return it == other.it; }
AT
auto beg = c.begin(), it = beg; assert(!c.empty()); do { f(it); } while (++it != beg);