3#ifdef FE_STD_FORMAT_SUPPORT
6# include <fmt/format.h>
15#ifdef FE_STD_FORMAT_SUPPORT
29 template<
class T,
class O> O
format(
const T& value, format::basic_format_context<O, Char>& ctx)
const {
30 std::basic_stringstream<Char> ss;
32#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION < 170000
33 return std::formatter<std::basic_string_view<Char>, Char>::format(ss.str(), ctx);
35 return format::formatter<std::basic_string_view<Char>, Char>::format(ss.view(), ctx);
46template<
class... Args>
void err (format::format_string<Args...> fmt, Args&&... args) { std::cerr << format::format(fmt, std::forward<Args&&>(args)...); }
47template<
class... Args>
void out (format::format_string<Args...> fmt, Args&&... args) { std::cout << format::format(fmt, std::forward<Args&&>(args)...); }
48template<
class... Args>
void errln(format::format_string<Args...> fmt, Args&&... args) { std::cerr << format::format(fmt, std::forward<Args&&>(args)...) << std::endl; }
49template<
class... Args>
void outln(format::format_string<Args...> fmt, Args&&... args) { std::cout << format::format(fmt, std::forward<Args&&>(args)...) << std::endl; }
62 size_t indent()
const {
return indent_; }
63 std::string_view
tab()
const {
return tab_; }
86 Tab operator--(
int) { assert(indent_ > 0);
auto res = *
this; --indent_;
return res; }
93 for (
size_t i = 0; i !=
tab.indent_; ++i) os <<
tab.tab_;
98 std::string_view tab_;
Keeps track of indentation level during output.
Tab operator-(size_t indent) const
Tab & operator-=(size_t indent)
friend std::ostream & operator<<(std::ostream &os, Tab tab)
Tab(std::string_view tab={"\t"}, size_t indent=0)
Tab operator+(size_t indent) const
Tab & operator+=(size_t indent)
Tab & operator=(std::string tab)
Tab & operator=(size_t indent)
std::string_view tab() const
void err(format::format_string< Args... > fmt, Args &&... args)
void out(format::format_string< Args... > fmt, Args &&... args)
void errln(format::format_string< Args... > fmt, Args &&... args)
void outln(format::format_string< Args... > fmt, Args &&... args)