5#ifndef INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_DEQUE_HPP_
6#define INCLUDE_GUARD_ARENE_BASE_ARENE_BASE_INLINE_CONTAINER_DEQUE_HPP_
13#include "arene/base/detail/iterator_interface.hpp"
14#include "arene/base/inline_container/detail/try_construct_interface.hpp"
15#include "arene/base/inline_container/detail/unsafe_element_storage.hpp"
19#include "arene/base/ranges/detail/range_interface.hpp"
20#include "arene/base/stdlib_choice/cstddef.hpp"
21#include "arene/base/stdlib_choice/declval.hpp"
22#include "arene/base/stdlib_choice/enable_if.hpp"
23#include "arene/base/stdlib_choice/forward.hpp"
24#include "arene/base/stdlib_choice/ignore.hpp"
25#include "arene/base/stdlib_choice/initializer_list.hpp"
26#include "arene/base/stdlib_choice/integral_constant.hpp"
27#include "arene/base/stdlib_choice/is_constructible.hpp"
28#include "arene/base/stdlib_choice/is_copy_assignable.hpp"
29#include "arene/base/stdlib_choice/is_copy_constructible.hpp"
30#include "arene/base/stdlib_choice/is_default_constructible.hpp"
31#include "arene/base/stdlib_choice/is_move_assignable.hpp"
32#include "arene/base/stdlib_choice/is_move_constructible.hpp"
33#include "arene/base/stdlib_choice/is_same.hpp"
34#include "arene/base/stdlib_choice/is_trivially_copyable.hpp"
35#include "arene/base/stdlib_choice/iterator_tags.hpp"
36#include "arene/base/stdlib_choice/iterator_traits.hpp"
37#include "arene/base/stdlib_choice/min_value_overload.hpp"
38#include "arene/base/stdlib_choice/move.hpp"
39#include "arene/base/stdlib_choice/numeric_limits.hpp"
50namespace inline_deque_detail {
59constexpr auto constrained_modulo(T value, T modulus)
noexcept -> T {
60 return value < modulus ? value : value - modulus;
70 return current_front > 0U ? current_front - 1U : capacity - 1U;
75struct physical_indices {
92template <std::
size_t Capacity,
bool AllowWrapping>
93class ring_buffer_indices {
100 static constexpr std::integral_constant<size_type, Capacity> capacity{};
105 constexpr auto back_index() const noexcept -> size_type {
return n_from_front(size() - 1U); }
111 constexpr auto n_from_back(size_type offset)
const noexcept -> size_type {
112 return n_from_front(size() - 1U - offset);
117 constexpr auto front_index() const noexcept -> size_type {
return front_; }
123 constexpr auto n_from_front(size_type offset)
const noexcept -> size_type {
124 return constrained_modulo(front_index() + offset, capacity());
129 constexpr auto next_at_front() const noexcept -> size_type {
return next_at_front_impl(front_index(), capacity()); }
133 constexpr auto next_at_back() const noexcept -> size_type {
return n_from_front(size()); }
137 constexpr auto size() const noexcept -> size_type {
return size_; }
141 constexpr auto empty() const noexcept ->
bool {
return size() == 0U; }
145 constexpr void shrink_at_front(size_type amount = 1U) noexcept {
146 front_ = n_from_front(amount);
151 constexpr void shrink_at_back() noexcept { --size_; }
154 constexpr void grow_at_front() noexcept {
155 front_ = next_at_front();
161 constexpr void grow_at_back(size_type amount = 1U) noexcept { size_ += amount; }
167 constexpr auto get_physical_indices(
std::size_t current_index)
const noexcept -> physical_indices {
168 return {current_index, front_index(), back_index(), capacity()};
173 size_type front_{0U};
178template <std::
size_t Capacity,
bool AllowWrapping>
179constexpr std::integral_constant<typename ring_buffer_indices<Capacity, AllowWrapping>::size_type, Capacity>
180 ring_buffer_indices<Capacity, AllowWrapping>::capacity;
186template <
typename Derived,
bool AllowWrapping>
187class storage_wrapping_interface {
190 constexpr auto derived() noexcept -> Derived& {
return static_cast<Derived&
>(*this); }
196 constexpr auto ensure_space_at_back() noexcept ->
void {
197 if (derived().
size() == Derived::capacity()) {
198 using value_type =
typename Derived::value_type;
204 derived().at_buffer_idx(derived().front_index()).~value_type();
205 derived().shrink_at_front();
215 constexpr auto ensure_space_at_front() noexcept ->
void {
216 if (derived().
size() == Derived::capacity()) {
217 using value_type =
typename Derived::value_type;
223 derived().at_buffer_idx(derived().back_index()).~value_type();
224 derived().shrink_at_back();
235template <
typename Derived>
236class storage_wrapping_interface<Derived, false> {
239 constexpr auto derived() const noexcept -> Derived const& {
return static_cast<Derived const&
>(*this); }
245 constexpr auto ensure_space_at_back() const noexcept ->
void {
252 constexpr auto ensure_space_at_front() const noexcept ->
void {
274class inline_deque_internal_storage
275 :
private array<inline_container::detail::unsafe_element_storage<T>, Capacity>
276 ,
private ring_buffer_indices<Capacity, AllowWrapping>
277 ,
protected storage_wrapping_interface<inline_deque_internal_storage<T, Capacity, AllowWrapping>, AllowWrapping> {
281 friend storage_wrapping_interface<inline_deque_internal_storage, AllowWrapping>;
285 using size_type =
typename ring_buffer_indices<Capacity, AllowWrapping>::size_type;
287 using value_type = T;
289 using reference = value_type&;
291 using const_reference = value_type
const&;
295 static constexpr std::integral_constant<size_type, Capacity> capacity{};
300 using ring_buffer_indices<Capacity, AllowWrapping>::size;
304 using ring_buffer_indices<Capacity, AllowWrapping>::empty;
307 using ring_buffer_indices<Capacity, AllowWrapping>::front_index;
310 using ring_buffer_indices<Capacity, AllowWrapping>::back_index;
313 using ring_buffer_indices<Capacity, AllowWrapping>::n_from_front;
316 using ring_buffer_indices<Capacity, AllowWrapping>::n_from_back;
319 using ring_buffer_indices<Capacity, AllowWrapping>::get_physical_indices;
323 using element_storage = inline_container::detail::unsafe_element_storage<T>;
327 static_assert(
alignof(element_storage) ==
alignof(T),
"Alignment must be the same");
329 static_assert(
sizeof(element_storage) ==
sizeof(T),
"Size must be the same");
334 using copy_constructor_arg =
335 conditional_t<std::is_copy_constructible<T>::value, inline_deque_internal_storage, non_constructible_dummy>;
342 inline_deque_internal_storage,
343 non_constructible_dummy>;
348 using move_constructor_arg =
349 conditional_t<std::is_move_constructible<T>::value, inline_deque_internal_storage, non_constructible_dummy>;
356 inline_deque_internal_storage,
357 non_constructible_dummy>;
361 constexpr inline_deque_internal_storage() =
default;
368 template <
typename Iterator>
369 constexpr inline_deque_internal_storage(Iterator in_begin, Iterator in_end)
noexcept(
371 std::is_nothrow_constructible<T, typename std::iterator_traits<Iterator>::reference>::value
373 : ::arene::base::array<element_storage, Capacity>{} {
378 while (in_begin != in_end) {
391 constexpr inline_deque_internal_storage(copy_constructor_arg
const& other
393 for (inline_deque_internal_storage::size_type i{}; i < other.size(); i++) {
394 std::ignore = emplace_front(other[other.n_from_back(i)].object);
404 constexpr inline_deque_internal_storage(move_constructor_arg&& other
406 for (inline_deque_internal_storage::size_type i{}; i < other.size(); i++) {
420 constexpr auto operator=(copy_assignment_arg
const& other
422 -> inline_deque_internal_storage& {
423 if (&other !=
this) {
425 while (this->size() > other.size()) {
430 inline_deque_internal_storage::size_type assignments{
std::min(this->size(), other.size())};
431 for (inline_deque_internal_storage::size_type i{}; i < assignments; ++i) {
432 (*this)[this->n_from_back(i)].object = other[other.n_from_back(i)].object;
436 if (this->size() < other.size()) {
437 size_type
const pushes{other.size() - this->size()};
438 for (inline_deque_internal_storage::size_type i{}; i < pushes; ++i) {
439 std::ignore = emplace_front(other[other.n_from_back(assignments + i)].object);
454 constexpr auto operator=(move_assignment_arg&& other
456 -> inline_deque_internal_storage& {
457 if (&other !=
this) {
458 size_type
const target_size{other.size()};
461 while (this->size() > target_size) {
466 for (inline_deque_internal_storage::size_type i{}; i < this->size(); ++i) {
467 (*this)[this->n_from_back(i)].object =
std::move(other[other.back_index()].object);
472 while (this->size() < target_size) {
487 ~inline_deque_internal_storage() { clear(); }
499 template <
typename... Args>
500 constexpr auto emplace_front(Args&&... args)
noexcept(std::is_nothrow_constructible<T, Args...>::value) -> T& {
501 this->ensure_space_at_front();
502 T& new_ref{*construct_at(&(*
this)[this->next_at_front()].
object,
std::forward<Args>(args)...)};
503 this->grow_at_front();
514 template <
typename... Args>
515 constexpr auto emplace_back(Args&&... args)
noexcept(std::is_nothrow_constructible<T, Args...>::value) -> T& {
516 this->ensure_space_at_back();
517 T& new_ref{*construct_at(&(*
this)[this->next_at_back()].
object,
std::forward<Args>(args)...)};
518 this->grow_at_back();
527 constexpr void pop_front() noexcept {
529 (*this)[this->front_index()].object.~T();
530 this->shrink_at_front();
535 constexpr void pop_back() noexcept {
537 (*this)[this->back_index()].object.~T();
538 this->shrink_at_back();
544 constexpr auto at_buffer_idx(
std::size_t buffer_idx)
const noexcept -> const_reference {
545 return (*
this)[buffer_idx].object;
551 constexpr auto at_buffer_idx(
std::size_t buffer_idx)
noexcept -> reference {
return (*
this)[buffer_idx].object; }
555 constexpr void clear() noexcept {
556 while (!this->empty()) {
574template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
575class inline_deque_internal_storage<T, Capacity, AllowWrapping, true>
576 :
private array<T, Capacity>
577 ,
private ring_buffer_indices<Capacity, AllowWrapping>
578 ,
protected storage_wrapping_interface<inline_deque_internal_storage<T, Capacity, AllowWrapping>, AllowWrapping> {
582 friend storage_wrapping_interface<inline_deque_internal_storage, AllowWrapping>;
586 using size_type =
typename ring_buffer_indices<Capacity, AllowWrapping>::size_type;
588 using value_type = T;
590 using reference = value_type&;
592 using const_reference = value_type
const&;
596 static constexpr std::integral_constant<size_type, Capacity> capacity{};
601 using ring_buffer_indices<Capacity, AllowWrapping>::size;
605 using ring_buffer_indices<Capacity, AllowWrapping>::empty;
608 using ring_buffer_indices<Capacity, AllowWrapping>::front_index;
611 using ring_buffer_indices<Capacity, AllowWrapping>::back_index;
614 using ring_buffer_indices<Capacity, AllowWrapping>::n_from_front;
617 using ring_buffer_indices<Capacity, AllowWrapping>::n_from_back;
620 using ring_buffer_indices<Capacity, AllowWrapping>::get_physical_indices;
624 constexpr inline_deque_internal_storage() noexcept
625 : array<T, Capacity>{},
626 ring_buffer_indices<Capacity, AllowWrapping>{},
627 storage_wrapping_interface<inline_deque_internal_storage, AllowWrapping>{} {}
635 template <
typename Iterator>
636 constexpr inline_deque_internal_storage(Iterator in_begin, Iterator in_end)
noexcept(
noexcept(
639 : ::arene::base::array<T, Capacity>{} {
643 typename ::arene::base::array<T, Capacity>::iterator
const new_end{
658 template <
typename... Args>
659 constexpr auto emplace_front(Args&&... args)
noexcept(std::is_nothrow_constructible<T, Args...>::value) -> T& {
660 this->ensure_space_at_front();
666 this->grow_at_front();
677 template <
typename... Args>
678 constexpr auto emplace_back(Args&&... args)
noexcept(std::is_nothrow_constructible<T, Args...>::value) -> T& {
679 this->ensure_space_at_back();
685 this->grow_at_back();
691 constexpr void pop_front() noexcept {
693 this->shrink_at_front();
698 constexpr void pop_back() noexcept {
700 this->shrink_at_back();
706 constexpr auto at_buffer_idx(
std::size_t buffer_idx)
const noexcept -> const_reference {
return (*
this)[buffer_idx]; }
711 constexpr auto at_buffer_idx(
std::size_t buffer_idx)
noexcept -> reference {
return (*
this)[buffer_idx]; }
715template <
typename T, std::
size_t Capacity,
bool AllowWrapping,
bool IsTrivial>
716constexpr std::integral_constant<
717 typename inline_deque_internal_storage<T, Capacity, AllowWrapping, IsTrivial>::size_type,
719 inline_deque_internal_storage<T, Capacity, AllowWrapping, IsTrivial>::capacity;
721template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
723 integral_constant<typename inline_deque_internal_storage<T, Capacity, AllowWrapping, true>::size_type, Capacity>
724 inline_deque_internal_storage<T, Capacity, AllowWrapping, true>::capacity;
732constexpr auto step_logical_index_forward(physical_indices
const& indices)
noexcept ->
std::size_t {
734 if (indices.current == indices.back) {
735 return indices.logical_end;
739 if (indices.current == indices.capacity - 1U) {
744 return indices.current + 1U;
751constexpr auto step_logical_index_backward(physical_indices
const& indices)
noexcept ->
std::size_t {
753 if (indices.current == indices.logical_end) {
759 return indices.capacity - 1U;
763 return indices.current - 1U;
770constexpr auto get_logical_index_impl(physical_indices
const& indices)
noexcept ->
std::ptrdiff_t {
772 indices.front <= indices.current ? indices.current : indices.current + indices.capacity
780template <
class T, std::
size_t Capacity>
781class inline_deque_try_construct_policy {
786 using value_type = T;
789 static constexpr auto capacity_of() noexcept -> size_type {
return Capacity; }
801template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
802class inline_deque_impl
803 :
private inline_deque_detail::inline_deque_internal_storage<T, Capacity, AllowWrapping>
804 ,
public ranges::detail::range_interface<inline_deque_impl<T, Capacity, AllowWrapping>> {
807 using storage_type = inline_deque_detail::inline_deque_internal_storage<T, Capacity, AllowWrapping>;
810 using range_interface = ranges::detail::range_interface<inline_deque_impl>;
817 template <
bool IsConst>
818 class cyclical_iterator :
public detail::iterator_interface<cyclical_iterator<IsConst>> {
821 using iterator_interface = detail::iterator_interface<cyclical_iterator<IsConst>>;
825 friend cyclical_iterator<true>;
831 using value_type = T;
839 using iterator_category = std::random_access_iterator_tag;
846 Capacity <= std::numeric_limits<std::size_t>::max(),
847 "inline_deque capacity() + 1U must be representable using the type of capacity()"
851 "inline_deque capacity must be expressable as its iterator's difference_type"
859 static constexpr std::integral_constant<std::size_t, std::numeric_limits<std::size_t>::max()> end_index{};
867 constexpr cyclical_iterator() noexcept
868 : iterator_interface(),
875 constexpr cyclical_iterator(
879 : iterator_interface(),
886 template <
bool Enable = IsConst, constra
ints<std::enable_if_t<Enable>> =
nullptr>
888 constexpr cyclical_iterator(cyclical_iterator<!Enable> non_const) noexcept
889 : iterator_interface(),
890 deque_(non_const.deque_),
891 idx_(non_const.idx_) {}
898 constexpr auto operator*() const noexcept -> reference {
902 return deque_->at_buffer_idx(idx_);
911 constexpr auto operator+=(difference_type diff)
noexcept -> cyclical_iterator& {
914 set_logical_index(get_logical_index() + diff);
927 friend constexpr auto operator-(cyclical_iterator
const& lhs, cyclical_iterator
const& rhs)
noexcept
933 difference_type
const logical_lhs_idx{lhs.get_logical_index()};
934 difference_type
const logical_rhs_idx{rhs.get_logical_index()};
936 return logical_lhs_idx - logical_rhs_idx;
946 friend constexpr auto operator==(cyclical_iterator
const& lhs, cyclical_iterator
const& rhs)
noexcept ->
bool {
947 return (lhs.deque_ == rhs.deque_) && (lhs.idx_ == rhs.idx_);
955 constexpr auto physical_index() const noexcept -> std::
size_t {
return idx_; }
960 constexpr auto logical_space_size() const noexcept -> difference_type {
961 return static_cast<difference_type
>(deque_->size() + 1U);
966 constexpr auto get_logical_index() const noexcept -> difference_type {
967 if (idx_ == end_index()) {
969 return static_cast<difference_type
>(deque_->size());
974 return inline_deque_detail::get_logical_index_impl(deque_->get_physical_indices(idx_));
981 constexpr auto set_logical_index(difference_type logical_idx)
noexcept ->
void {
982 if (logical_idx + 1 == logical_space_size()) {
985 idx_ = inline_deque_detail::constrained_modulo(
986 deque_->front_index() +
static_cast<std::size_t>(logical_idx),
997 constexpr auto do_step_forward() noexcept ->
void {
998 idx_ = inline_deque_detail::step_logical_index_forward(deque_->get_physical_indices(idx_));
1006 constexpr auto do_step_backward() noexcept ->
void {
1007 idx_ = inline_deque_detail::step_logical_index_backward(deque_->get_physical_indices(idx_));
1024 friend constexpr auto step_forward(detail::iterator_interface_tag, cyclical_iterator& self)
noexcept ->
void {
1025 self.do_step_forward();
1034 friend constexpr auto step_backward(detail::iterator_interface_tag, cyclical_iterator& self)
noexcept ->
void {
1035 self.do_step_backward();
1056 using size_type =
typename storage_type::size_type;
1058 using value_type = T;
1061 using reference = value_type&;
1063 using const_reference = value_type
const&;
1065 using iterator = cyclical_iterator<false>;
1067 using const_iterator = cyclical_iterator<true>;
1071 static constexpr std::integral_constant<size_type, Capacity> capacity{};
1074 static constexpr std::integral_constant<bool, AllowWrapping> wrapping_allowed{};
1079 constexpr inline_deque_impl() noexcept
1081 range_interface(this) {}
1095 std::is_constructible<value_type, typename std::iterator_traits<Iterator>::reference>::value>> =
nullptr>
1096 constexpr inline_deque_impl(Iterator in_begin, Iterator in_end)
noexcept(
1098 std::is_nothrow_constructible<value_type, typename std::iterator_traits<Iterator>::reference>::value
1100 : storage_type(in_begin, in_end),
1101 range_interface(this) {}
1104 using storage_type::empty;
1109 constexpr auto begin() const noexcept -> const_iterator {
1110 if (this->empty()) {
1113 return {*
this, this->front_index()};
1118 constexpr auto begin() noexcept -> iterator {
1119 if (this->empty()) {
1122 return {*
this, this->front_index()};
1127 constexpr auto end() const noexcept -> const_iterator {
return {*
this, const_iterator::end_index}; }
1131 constexpr auto end() noexcept -> iterator {
return {*
this, iterator::end_index}; }
1138 using range_interface::cbegin;
1140 using range_interface::cend;
1143 using range_interface::rbegin;
1145 using range_interface::rend;
1148 using range_interface::crbegin;
1150 using range_interface::crend;
1153 using range_interface::front;
1155 using range_interface::back;
1157 using range_interface::operator[];
1161 using storage_type::size;
1166 using storage_type::emplace_front;
1171 using storage_type::emplace_back;
1220 template <
typename U,
bool Wrap = wrapping_allowed, constra
ints<std::enable_if_t<Wrap>> =
nullptr>
1222 -> inline_deque_impl::iterator {
1223 if (this->size() < this->capacity()) {
1227 return this->begin();
1238 template <
typename U,
bool Wrap = wrapping_allowed, constra
ints<std::enable_if_t<!Wrap>> =
nullptr>
1240 -> inline_deque_impl::iterator {
1242 return this->begin();
1250 template <
typename U>
1252 -> inline_deque_impl::iterator {
1255 return inline_deque_impl::iterator(*
this, this->back_index());
1266 template <
typename U>
1267 constexpr auto internal_insert_in_middle(inline_deque_impl::const_iterator pos, U&& value)
noexcept(
1270 ) -> inline_deque_impl::iterator {
1272 this->ensure_space_at_back();
1275 auto mutable_pos = inline_deque_impl::iterator(*
this, pos.physical_index());
1276 inline_deque_impl::iterator insertion_target;
1282 if (
static_cast<size_type
>(
distance(this->
cbegin(), pos)) < (this->capacity() / 2U)) {
1286 insertion_target = rotate(this->begin(),
next(this->begin()), mutable_pos);
1291 std::ignore = rotate(mutable_pos, inline_deque_impl::iterator(*
this, this->back_index()), this->end());
1292 insertion_target = mutable_pos;
1297 return insertion_target;
1311 template <
typename U>
1312 constexpr auto internal_insert(inline_deque_impl::const_iterator pos, U&& value)
noexcept(
noexcept(
1316 -> inline_deque_impl::iterator {
1317 if (pos == this->
cbegin()) {
1320 if (pos == this->
cend()) {
1341 typename U = value_type,
1343 std::enable_if_t<std::is_same<U, value_type>::value>,
1344 std::enable_if_t<std::is_copy_assignable<U>::value>,
1345 std::enable_if_t<std::is_move_assignable<U>::value>,
1346 std::enable_if_t<std::is_move_constructible<U>::value>> =
nullptr>
1347 constexpr auto insert(inline_deque_impl::const_iterator pos, value_type
const& value)
noexcept(
1349 ) -> inline_deque_impl::iterator {
1350 return this->internal_insert(pos, value);
1366 typename U = value_type,
1368 std::enable_if_t<std::is_same<U, value_type>::value>,
1369 std::enable_if_t<std::is_move_assignable<U>::value>,
1370 std::enable_if_t<std::is_move_constructible<U>::value>> =
nullptr>
1371 constexpr auto insert(inline_deque_impl::const_iterator pos, value_type&& value)
noexcept(
1373 ) -> inline_deque_impl::iterator {
1374 return this->internal_insert(pos,
std::move(value));
1379 using storage_type::pop_front;
1383 using storage_type::pop_back;
1387template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
1388constexpr std::integral_constant<typename inline_deque_impl<T, Capacity, AllowWrapping>::size_type, Capacity>
1389 inline_deque_impl<T, Capacity, AllowWrapping>::capacity;
1391template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
1392constexpr std::integral_constant<bool, AllowWrapping> inline_deque_impl<T, Capacity, AllowWrapping>::wrapping_allowed;
1394template <
typename T, std::
size_t Capacity,
bool AllowWrapping>
1395template <
bool IsConst>
1396constexpr std::integral_constant<std::size_t, std::numeric_limits<std::size_t>::max()>
1397 inline_deque_impl<T, Capacity, AllowWrapping>::cyclical_iterator<IsConst>::end_index;
1408template <
typename T, std::
size_t Capacity>
1410 :
private inline_deque_detail::inline_deque_impl<T, Capacity, false>
1411 ,
public inline_container_detail::try_construct_interface<
1412 inline_deque<T, Capacity>,
1413 typename inline_deque_detail::inline_deque_try_construct_policy<T, Capacity>> {
1415 using impl = inline_deque_detail::inline_deque_impl<T, Capacity, false>;
1418 using try_construct_interface = inline_container_detail::try_construct_interface<
1420 typename inline_deque_detail::inline_deque_try_construct_policy<T, Capacity>>;
1426 using typename impl::const_reference;
1430 using typename impl::reference;
1432 using typename impl::size_type;
1434 using typename impl::value_type;
1437 using impl::wrapping_allowed;
1443 try_construct_interface(this) {}
1462 : impl(in_begin, in_end),
1463 try_construct_interface(this) {}
1470 template <typename U = value_type, constraints<std::enable_if_t<std::is_copy_constructible<U>::value>> =
nullptr>
1472 )
noexcept(
noexcept(
inline_deque(init.begin(), init.end())))
1477 using impl::capacity;
1505 using impl::operator[];
1508 using impl::emplace_back;
1510 using impl::emplace_front;
1512 using impl::pop_back;
1514 using impl::pop_front;
1516 using impl::push_back;
1518 using impl::push_front;
constexpr auto cend() const noexcept -> const_iterator
Definition array.hpp:201
constexpr auto end() noexcept -> iterator
Definition array.hpp:163
constexpr auto back() noexcept -> T &
Definition array.hpp:284
detail::wrapped_iterator< const_pointer, array_detail::array_iter_passkey > const_iterator
Definition array.hpp:107
constexpr auto rbegin() noexcept -> reverse_iterator
Definition array.hpp:181
constexpr auto front() noexcept -> T &
Definition array.hpp:274
detail::wrapped_iterator< pointer, array_detail::array_iter_passkey > iterator
Definition array.hpp:105
constexpr auto crend() const noexcept -> const_reverse_iterator
Definition array.hpp:209
constexpr auto cbegin() const noexcept -> const_iterator
Definition array.hpp:197
constexpr auto crbegin() const noexcept -> const_reverse_iterator
Definition array.hpp:205
constexpr auto rend() noexcept -> reverse_iterator
Definition array.hpp:185
constexpr auto begin() noexcept -> iterator
Definition array.hpp:158
constexpr inline_deque(Iterator in_begin, Iterator in_end) noexcept(noexcept(::arene::base::distance(in_begin, in_end)) &&std::is_nothrow_constructible< value_type, typename std::iterator_traits< Iterator >::reference >::value)
Construct a queue from a range of elements, taken to be in front -> back order.
Definition deque.hpp:1458
constexpr inline_deque() noexcept
Construct an empty queue.
Definition deque.hpp:1441
constexpr inline_deque(std::initializer_list< value_type > init) noexcept(noexcept(inline_deque(init.begin(), init.end())))
Construct a deque by copying from an initializer list of elements, taken to be in front -> back order...
Definition deque.hpp:1471
Implementation of std::initializer_list for brace initialization.
Definition initializer_list.hpp:21
static constexpr value_type value
Definition integral_constant.hpp:34
Type trait to detect if a type is constructible from arguments of the specified types.
Definition is_constructible.hpp:29
Type trait to detect if a type is constructible from arguments of the specified types and is noexcept...
Definition is_constructible.hpp:84
static constexpr auto max() noexcept -> T
The maximum finite value.
Definition numeric_limits.hpp:230
#define ARENE_PRECONDITION(condition)
Check that a precondition holds, and terminate the application if it does not.
Definition contract.hpp:150
Definition accumulate.hpp:37
constexpr std::integral_constant< std::size_t, N > array< T, N >::size
Definition array.hpp:534
ARENE_NODISCARD constexpr auto next(Iterator itr, typename std::iterator_traits< Iterator >::difference_type steps=1) noexcept(noexcept(::arene::base::advance(itr, steps))) -> Iterator
Produces the Nth successor (or predecessor if steps is negative) of an iterator.
Definition next.hpp:38
typename static_if< B >::template then_else< T, F > conditional_t
lazily select between two types based on a boolean condition
Definition conditional.hpp:28
constexpr auto distance(Iterator first, Iterator last) noexcept(noexcept(distance_impl::do_distance(first, last, typename std::iterator_traits< Iterator >::iterator_category{}))) -> typename std::iterator_traits< Iterator >::difference_type
Find the number of elements between first and last.
Definition distance.hpp:79
constexpr auto copy(InputIterator first, InputIterator last, OutputIterator output) noexcept(noexcept(*(++output)) &&noexcept(*(++first)) &&noexcept(first !=last) &&std::is_nothrow_assignable<, typename std::iterator_traits< InputIterator >::reference >::value) -> OutputIterator
Copies the elements in the range, defined by [first, last), to another range beginning at output.
Definition copy.hpp:40
typename constraints_impl::constraints< EnableIfs... >::type constraints
Helper used to express template constraints in a consistent way using std::enable_if_t.
Definition constraints.hpp:51
Definition accumulate.hpp:36
::ptrdiff_t ptrdiff_t
A type suitable for holding the difference between two pointers.
Definition cstddef.hpp:31
constexpr auto move(T &&value) noexcept -> remove_reference_t< T > &&
Cast a value to an rvalue.
Definition move.hpp:30
::size_t size_t
A type suitable for holding the size of an object.
Definition cstddef.hpp:29
typename enable_if< Condition, Type >::type enable_if_t
Type alias to support constraining templates. Is an alias for the specified type if the Condition is ...
Definition enable_if.hpp:41
auto declval() noexcept -> T &&
A dummy function that is declared but not defined, with a user-specified return type,...
constexpr auto min(initializer_list< T > list, Compare comp) noexcept(noexcept(comp(std::declval< T & >(), std::declval< T & >())) &&std::is_nothrow_copy_constructible_v< T >) -> T
Returns the smallest value in the std::initializer_list.
Definition min_initializer_list_overload.hpp:50
static constexpr auto const & ignore
An object to which anything can be assigned, which ignores the assigned value.
Definition ignore.hpp:72
constexpr auto forward(remove_reference_t< T > &value) noexcept -> T &&
Cast a value to an rvalue if T is an rvalue or rvalue reference, otherwise forward an lvalue referenc...
Definition forward.hpp:24
Provides backports of the safe integer comparison functions from C++20.