proxy

basic_facade_builder::support_format
basic_facade_builder::support_wformat

using support_format = basic_facade_builder</* see below */>;  // since 3.2.0

using support_wformat = basic_facade_builder</* see below */>;  // since 3.2.0

The member types support_format and support_wformat of basic_facade_builder<Cs, Rs, C> add necessary convention and reflection types to the template parameters, enabling specializations of std::formatter<proxy_indirect_accessor<F>, CharT> where F is a facade type built from basic_facade_builder, CharT is char (if support_format is specified) or wchar_t (if support_wformat is specified).

support_format and support_wformat also add constraints to a facade type F built from basic_facade_builder, requiring a contained value of proxy<F> be formattable. Formally, let p be a contained value of proxy<F>, CharT be char (if support_format is specified) or wchar_t (if support_wformat is specified), T be std::decay_t<decltype(*std::as_const(p))>, std::formatter<T, CharT> shall be an enabled specialization of std::formatter.

Example

#include <format>
#include <iostream>

#include "proxy.h"

struct Formattable : pro::facade_builder
    ::support_format
    ::build {};

int main() {
  pro::proxy<Formattable> p = pro::make_proxy<Formattable>(123);
  std::cout << std::format("{}", *p) << "\n";  // Prints "123"
  std::cout << std::format("{:*<6}", *p) << "\n";  // Prints "123***"
}

See Also