2.8 KiB
[format.range.fmtkind]
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_range "25.4.6 Other range refinements [range.refinements]") R> requires [same_as](concept.same#concept:same_as "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_kind is ill-formed.
For a type R, format_kind is defined as follows:
-
If same_as<remove_cvref_t<ranges::range_reference_t>, R> is true,format_kind 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_type is valid and denotes a type:
-
If the qualified-id R::mapped_type is valid and denotes a type, let U be remove_cvref_t<ranges::range_reference_t>. If either U is a specialization of pair orU is a specialization of tuple andtuple_size_v == 2,format_kind is range_format::map.
-
Otherwise, format_kind is range_format::set.
-
-
Otherwise, format_kind is range_format::sequence.
Remarks: Pursuant to [namespace.std], users may specialize format_kind for 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.