40template <
class Impl,
class Index = std::u
int64_t>
42 static_assert(std::is_integral_v<Index> && std::is_unsigned_v<Index> &&
43 !std::is_same_v<Index, bool> &&
44 std::numeric_limits<Index>::digits <= 64);
87 return impl().value_at_impl(position);
113 impl().rotate_left_impl(left, right, distance);
125 void merge(Impl& donor) { impl().merge_impl(donor); }
136 return impl().memory_usage_bytes_impl();
140 Impl& impl() noexcept {
return static_cast<Impl&
>(*this); }
141 const Impl& impl() const noexcept {
return static_cast<const Impl&
>(*this); }
CRTP contract for exclusively owned permutations of [0,size()).
Definition permutation.h:41
Index value_type
Stored index type.
Definition permutation.h:48
const_reference operator[](size_type position) const
Read a checked zero-based index by value.
Definition permutation.h:86
std::size_t size_type
Count and position type.
Definition permutation.h:53
static Impl identity(size_type n)
Construct an owning identity permutation.
Definition permutation.h:65
void merge(Impl &donor)
Append donor indices plus the old receiver size and consume donor.
Definition permutation.h:125
bool empty() const noexcept
Test emptiness.
Definition permutation.h:77
void insert_at(size_type position)
Insert the next identity value at a zero-based position.
Definition permutation.h:100
size_type memory_usage_bytes() const noexcept
Explicitly account for requested live storage.
Definition permutation.h:135
Index const_reference
Immutable read result.
Definition permutation.h:51
void rotate_left(size_type left, size_type right, size_type distance)
Rotate [left,right) left, preserving outside indices.
Definition permutation.h:112
size_type size() const noexcept
Return the logical index count.
Definition permutation.h:71
Shared compile-time sequence tuning options.