Variants

User:T. Canens/ranges notes

From cppreference.com
  • Qualification style: ranges::foo and std::foo.
    • Exception: for something in std, spell out the full std::experimental::ranges::foo
  • Decide on where/how to decompose complex concepts (Sortable being an example):
    • Template transcluded on each algorithm page using it?
    • Note on the concept's page?
    • Goal: A user shouldn't have to click on more than a couple of links to figure out what T has to satisfy in order to use ranges::sort on a std::vector<T>.
  • Cover [concepts.lib.general.equality] somewhere.
    • Key points: equality preservation; which inputs may be modified; implicit expression variants
    • Decide how to cover them.
      • Template and transclude on every concept page that is relevant?
      • Dedicated section + links?
  • Algorithms.
  • No intended difference between R(&f)() and use f() vs. "f be an expression such that decltype((f)) is R" and use f. But need to watch out for possible missing "equality-preserving". See issues #531 and #532

implicit expression variations

  • Casey: "implicit expression variations" applies to all id-expressions that are const lvalues (after substitution)
    • Non-id-expressions not included
    • Remember to check while writing if it's sane
  • Casey: intended that ranges::Assignable<T&, const T&> spawn variations for the expression in
requires(T t, U&& u) {
    { t = std::forward<U>(u) } -> ranges::Same<T>&&;
  }

, treating the whole std::forward<U>(u) as the "operand" (not just the id-expression u, contrary to previous note)

  • Casey: This is needed for Copyable.
  • Casey: standalone ranges::Assignable<T&, const T&> requires all implicit variations on the assignment expression to be non-modifying for the right operand (including when it's a non-const rvalue), but ranges::Copyable<T> removes that requirement because it also requires ranges::Movable which requires ranges::Assignable<T&, T>, which counts as an explicit requirement that supersedes the implicit requirement.
    • i.e., the same concept-id can mean different things depending on whether it is used stand-alone or as part of another concept. Explicit/implicit superseding can happen "at a distance" and isn't local to a concept.