[format.range.fmtkind]

# 28 Text processing library [[text]](./#text)

## 28.5 Formatting [[format]](format#range.fmtkind)

### 28.5.7 Formatting of ranges [[format.range]](format.range#fmtkind)

#### 28.5.7.1 Variable template format_kind [format.range.fmtkind]

[ð](#lib:format_kind)

`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;
`

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L7841)

A program that instantiates the primary template of format_kind is ill-formed[.](#1.sentence-1)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L7845)

For a type R, format_kind<R> is defined as follows:

- [(2.1)](#2.1)

  If [same_as](concept.same#concept:same_as "18.4.2 Concept same_­as [concept.same]")<remove_cvref_t<ranges​::​range_reference_t<R>>, R> is true,format_kind<R> is range_format​::​disabled[.](#2.1.sentence-1)
  [*Note [1](#note-1)*:
  This prevents constraint recursion for ranges whose
reference type is the same range type[.](#2.1.sentence-2)
  For example,std​::​filesystem​::​path is a range of std​::​filesystem​::​path[.](#2.1.sentence-3)
 â *end note*]

- [(2.2)](#2.2)

  Otherwise, if the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") R​::​key_type is valid and denotes a type:
  * [(2.2.1)](#2.2.1)

      If the [*qualified-id*](expr.prim.id.qual#nt:qualified-id "7.5.5.3 Qualified names [expr.prim.id.qual]") R​::​mapped_type is valid and denotes a type,
let U be remove_cvref_t<ranges​::​range_reference_t<R>>[.](#2.2.1.sentence-1)
      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[.](#2.2.1.sentence-2)

  * [(2.2.2)](#2.2.2)

      Otherwise, format_kind<R> is range_format​::​set[.](#2.2.2.sentence-1)

- [(2.3)](#2.3)

  Otherwise, format_kind<R> is range_format​::​sequence[.](#2.3.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/text.tex#L7879)

*Remarks*: Pursuant to [[namespace.std]](namespace.std "16.4.5.2.1 Namespace std"), users may specialize format_kind for cv-unqualified program-defined types
that model ranges​::​[input_range](range.refinements#concept:input_range "25.4.6 Other range refinements [range.refinements]")[.](#3.sentence-1)

Such specializations shall be usable in constant expressions ([[expr.const]](expr.const "7.7 Constant expressions"))
and have type const range_format[.](#3.sentence-2)
