[format.range.fmtkind] (original) (raw)
28 Text processing library [text]
28.5 Formatting [format]
28.5.7 Formatting of ranges [format.range]
28.5.7.1 Variable template format_kind [format.range.fmtkind]
template<ranges::[input_range](range.refinements#concept:input%5Frange "25.4.5 Other range refinements [range.refinements]") R> requires [same_as](concept.same#concept:same%5Fas "18.4.2 Concept same_as [concept.same]")<R, remove_cvref_t<R>> constexpr range_format format_kind<R> = _see below_;
A program that instantiates the primary template of format_kindis ill-formed.
For a type R, format_kind<R> is defined as follows:
- If same_as<remove_cvref_t<ranges::range_reference_t<R>>, R>is true,format_kind<R> is range_format::disabled.
[Note 1:
This prevents constraint recursion for ranges whose reference type is the same range type.
For example,std::filesystem::path is a range of std::filesystem::path.
— _end note_] - Otherwise, if the qualified-id R::key_typeis valid and denotes a type:
- If the qualified-id R::mapped_typeis valid and denotes a type, let U be remove_cvref_t<ranges::range_reference_t<R>>.
If either U is a specialization of pair orU is a specialization of tuple andtuple_size_v<U> == 2,format_kind<R> is range_format::map. - Otherwise, format_kind<R> is range_format::set.
- If the qualified-id R::mapped_typeis valid and denotes a type, let U be remove_cvref_t<ranges::range_reference_t<R>>.
- Otherwise, format_kind<R> is range_format::sequence.
Remarks: Pursuant to [namespace.std], users may specialize format_kindfor cv-unqualified program-defined types that model ranges::input_range.
Such specializations shall be usable in constant expressions ([expr.const]) and have type const range_format.