Files
2025-10-25 03:02:53 +03:00

2.8 KiB
Raw Permalink Blame History

[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.6Other range refinements[range.refinements]") R> requires [same_as](concept.same#concept:same_as "18.4.2Concept same_­as[concept.same]")<R, remove_cvref_t<R>> constexpr range_format format_kind<R> = see below;

1

#

A program that instantiates the primary template of format_kind is ill-formed.

2

#

For a type R, format_kind is defined as follows:

  • (2.1)

    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]

  • (2.2)

    Otherwise, if the qualified-id R::key_type is valid and denotes a type:

    • (2.2.1)

      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.

    • (2.2.2)

      Otherwise, format_kind is range_format::set.

  • (2.3)

    Otherwise, format_kind is range_format::sequence.

3

#

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.