[container.adaptors.format]

# 23 Containers library [[containers]](./#containers)

## 23.6 Container adaptors [[container.adaptors]](container.adaptors#format)

### 23.6.13 Container adaptors formatting [container.adaptors.format]

[1](#1)

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

For each ofqueue,priority_queue, andstack,
the library provides the following formatter specialization
where *adaptor-type* is the name of the template:

[ð](#lib:formatter)

namespace std {template<class charT, class T, [formattable](format.formattable#concept:formattable "28.5.6.3 Concept formattable [format.formattable]")<charT> Container, class... U>struct formatter<*adaptor-type*<T, Container, U...>, charT> {private:using *maybe-const-container* = // *exposition only**fmt-maybe-const*<Container, charT>; using *maybe-const-adaptor* = // *exposition only**maybe-const*<is_const_v<*maybe-const-container*>, // see [[ranges.syn]](ranges.syn "25.2 Header <ranges> synopsis")*adaptor-type*<T, Container, U...>>;
 formatter<ranges::ref_view<*maybe-const-container*>, charT> *underlying_*; // *exposition only*public:template<class ParseContext>constexpr typename ParseContext::iterator
 parse(ParseContext& ctx); template<class FormatContext>typename FormatContext::iterator
 format(*maybe-const-adaptor*& r, FormatContext& ctx) const; };}

[ð](#lib:parse,formatter)

`template<class ParseContext>
  constexpr typename ParseContext::iterator
    parse(ParseContext& ctx);
`

[2](#2)

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

*Effects*: Equivalent to: return *underlying_*.parse(ctx);

[ð](#lib:format,formatter)

`template<class FormatContext>
  typename FormatContext::iterator
    format(maybe-const-adaptor& r, FormatContext& ctx) const;
`

[3](#3)

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

*Effects*: Equivalent to: return *underlying_*.format(r.c, ctx);
