A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fmtlib/fmt/commit/bc3af512720da527690c58d2edab4ca1892b1f1d below:

Reduce the number of instantiations · fmtlib/fmt@bc3af51 · GitHub

File tree Expand file treeCollapse file tree 2 files changed

+11

-11

lines changed

Filter options

Expand file treeCollapse file tree 2 files changed

+11

-11

lines changed Original file line number Diff line number Diff line change

@@ -876,20 +876,20 @@ template <typename T> struct format_as_result {

876 876

};

877 877

template <typename T> using format_as_t = typename format_as_result<T>::type;

878 878 879 -

template <typename Context, typename T>

879 +

template <typename Char, typename T>

880 880

constexpr auto has_const_formatter_impl(T*)

881 -

-> decltype(typename Context::template formatter_type<T>().format(

882 -

std::declval<const T&>(), std::declval<Context&>()),

881 +

-> decltype(formatter<T, Char>().format(

882 +

std::declval<const T&>(),

883 +

std::declval<buffered_context<Char>&>()),

883 884

true) {

884 885

return true;

885 886

}

886 -

template <typename Context>

887 -

constexpr auto has_const_formatter_impl(...) -> bool {

887 +

template <typename Char> constexpr auto has_const_formatter_impl(...) -> bool {

888 888

return false;

889 889

}

890 -

template <typename T, typename Context>

890 +

template <typename T, typename Char>

891 891

constexpr auto has_const_formatter() -> bool {

892 -

return has_const_formatter_impl<Context>(static_cast<T*>(nullptr));

892 +

return has_const_formatter_impl<Char>(static_cast<T*>(nullptr));

893 893

}

894 894 895 895

struct unformattable {};

@@ -1002,7 +1002,7 @@ template <typename Context> struct arg_mapper {

1002 1002 1003 1003

template <typename T, typename U = remove_const_t<T>>

1004 1004

struct formattable

1005 -

: bool_constant<has_const_formatter<U, Context>() ||

1005 +

: bool_constant<has_const_formatter<U, char_type>() ||

1006 1006

(std::is_constructible<formatter<U, char_type>>::value &&

1007 1007

!std::is_const<T>::value)> {};

1008 1008

@@ -2341,7 +2341,7 @@ template <typename Context> class value {

2341 2341

auto f = Formatter();

2342 2342

parse_ctx.advance_to(f.parse(parse_ctx));

2343 2343

using qualified_type =

2344 -

conditional_t<has_const_formatter<T, Context>(), const T, T>;

2344 +

conditional_t<has_const_formatter<T, char_type>(), const T, T>;

2345 2345

// format must be const for compatibility with std::format and compilation.

2346 2346

const auto& cf = f;

2347 2347

ctx.advance_to(cf.format(*static_cast<qualified_type*>(arg), ctx));

Original file line number Diff line number Diff line change

@@ -820,9 +820,9 @@ TEST(base_test, format_explicitly_convertible_to_std_string_view) {

820 820 821 821

TEST(base_test, has_const_formatter) {

822 822

EXPECT_TRUE((fmt::detail::has_const_formatter<const_formattable,

823 -

fmt::format_context>()));

823 +

char>()));

824 824

EXPECT_FALSE((fmt::detail::has_const_formatter<nonconst_formattable,

825 -

fmt::format_context>()));

825 +

char>()));

826 826

}

827 827 828 828

TEST(base_test, format_nonconst) {

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4