Dedekind 0.0.0
A structuralist C++23 Module Library
Loading...
Searching...
No Matches
dedekind::sequences::detail Namespace Reference

The interval ↔ iota_view bridge: order's Interval<T,L>, a value, read as the half-open std::ranges::iota_view [start, bound), and back, as a total inverse. More...

Classes

struct  toy_countable_family
struct  IotaBounds
 The [start, bound) iota_view bounds a finite value set normalises to (shared between to_iota_view and from_iota_view): the Interval / Singleton / Empty kinds of a Interval, read off its value endpoints. An unbounded kind (Halfspace / Universe) has no finite range and yields the empty bounds; a per-arm overload will refuse it once the set is a coproduct (#970). More...

Functions

constexpr auto natural_indices (std::size_t count)
template<std::floating_point R>
constexpr R euclidean_distance (R a, R b)
template<std::floating_point R>
constexpr R metric_norm (R point, R origin=static_cast< R >(0))
template<std::floating_point R>
constexpr bool in_closed_euclidean_ball (R center, R point, R radius)
template<std::integral T, typename L>
constexpr IotaBounds< T > iota_bounds (const dedekind::order::Interval< T, L > &s)

Detailed Description

The interval ↔ iota_view bridge: order's Interval<T,L>, a value, read as the half-open std::ranges::iota_view [start, bound), and back, as a total inverse.

ranges__Halfspace_To_Iota_View_Bridge

to_iota_view normalises the four strictness combinations to iota_view's canonical shape through the NNO step:

  • lower Strict ⇒ start = succ(lo) (predicate x > lo)
  • lower NonStrict ⇒ start = lo (predicate x ≥ lo)
  • upper Strict ⇒ bound = hi (predicate x < hi)
  • upper NonStrict ⇒ bound = succ(hi) (predicate x ≤ hi)

and from_iota_view<SL,SU> undoes the offsets and constructs the interval with Interval::bounded — total, no rejection path: every half-open [start, bound) is an interval (the empty view is the empty interval). Both directions are constexpr and the round-trip is witnessed as values in sequences/halfspace_to_iota_test.