Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::formatter<std::stack>

      From cppreference.com
      <cpp‎ |container‎ |stack

      [edit template]
       
       
       
       
      Defined in header<stack>
      template<class CharT,class T,std::formattable<CharT> Container,class...U>
      struct formatter<std::stack<T, Container, U...>, CharT>;
      (since C++23)

      The template specialization ofstd::formatter for the container adaptor typestd::stack allows users to convert the underlying container to its textual representation as a collection of elements usingformatting functions.

      The specialization is enabled ifstd::formattable<Container, CharT> istrue.

      Contents

      [edit]Member types

      Name Definition
      maybe-const-containerfmt-maybe-const <Container, CharT>
      (exposition-only member type*)
      maybe-const-adaptormaybe-const <
          std::is_const_v<maybe-const-container>,
          std::stack<T, Container, U...>>

      (exposition-only member type*)

      [edit]Data members

      Name Definition
      underlying_ underlying formatter of typestd::formatter<ranges::ref_view<maybe-const-container>, CharT>
      (exposition-only member object*)

      [edit]Member functions

      parse
      parses the format specifier as specified byrange-format-spec
      (public member function)
      format
      writes the range formatted output as specified byrange-format-spec
      (public member function)

      std::formatter<std::stack>::parse

      template<class ParseContext>
      constexprauto parse( ParseContext& ctx)-> ParseContext::iterator;

      Equivalent toreturn underlying_ .parse(ctx);.

      Return value

      An iterator past the end of therange-format-spec of the underlying container.

      std::formatter<std::stack>::format

      template<class FormatContext>

      auto format(/*maybe-const-adaptor*/& r, FormatContext& ctx)const

         -> FormatContext::iterator;

      Equivalent toreturn underlying_ .format(r.c, ctx);.

      Return value

      An iterator past the end of the output range.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]See also

      (C++20)
      defines formatting rules for a given type
      (class template)[edit]
      class template that helps implementingstd::formatter specializations for range types
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/container/stack/formatter&oldid=171221"

      [8]ページ先頭

      ©2009-2025 Movatter.jp