mirror of
https://github.com/shadps4-emu/ext-fmt.git
synced 2024-11-23 09:49:42 +00:00
Remove legacy workaround
This commit is contained in:
parent
c177324ba9
commit
6af30d8f75
@ -1901,12 +1901,7 @@ using is_formattable = bool_constant<!std::is_base_of<
|
||||
\endrst
|
||||
*/
|
||||
template <typename Context, size_t NUM_NAMED_ARGS, typename... Args>
|
||||
class format_arg_store_impl
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||
// Workaround a GCC template argument substitution bug.
|
||||
: public basic_format_args<Context>
|
||||
#endif
|
||||
{
|
||||
class format_arg_store_impl {
|
||||
private:
|
||||
static const size_t num_args = sizeof...(Args);
|
||||
static const bool is_packed = num_args <= detail::max_packed_args;
|
||||
@ -1923,11 +1918,7 @@ class format_arg_store_impl
|
||||
public:
|
||||
template <typename... T>
|
||||
FMT_CONSTEXPR FMT_INLINE format_arg_store_impl(T&... args)
|
||||
:
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||
basic_format_args<Context>(*this),
|
||||
#endif
|
||||
args_{value_type(named_args_, NUM_NAMED_ARGS),
|
||||
: args_{value_type(named_args_, NUM_NAMED_ARGS),
|
||||
detail::make_arg<is_packed, Context>(args)...} {
|
||||
detail::init_named_args(named_args_, 0, 0, args...);
|
||||
}
|
||||
@ -1944,13 +1935,9 @@ class format_arg_store_impl
|
||||
}
|
||||
};
|
||||
|
||||
// A specialization of format_arg_store_impl without named arguments.
|
||||
template <typename Context, typename... Args>
|
||||
class format_arg_store_impl<Context, 0, Args...>
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||
// Workaround a GCC template argument substitution bug.
|
||||
: public basic_format_args<Context>
|
||||
#endif
|
||||
{
|
||||
class format_arg_store_impl<Context, 0, Args...> {
|
||||
private:
|
||||
static const size_t num_args = sizeof...(Args);
|
||||
static const bool is_packed = num_args <= detail::max_packed_args;
|
||||
@ -1964,12 +1951,7 @@ class format_arg_store_impl<Context, 0, Args...>
|
||||
public:
|
||||
template <typename... T>
|
||||
FMT_CONSTEXPR FMT_INLINE format_arg_store_impl(T&... args)
|
||||
:
|
||||
#if FMT_GCC_VERSION && FMT_GCC_VERSION < 409
|
||||
basic_format_args<Context>(*this),
|
||||
#endif
|
||||
args_{detail::make_arg<is_packed, Context>(args)...} {
|
||||
}
|
||||
: args_{detail::make_arg<is_packed, Context>(args)...} {}
|
||||
|
||||
static constexpr unsigned long long desc =
|
||||
(is_packed ? detail::encode_types<Context, Args...>()
|
||||
@ -1986,10 +1968,10 @@ using format_arg_store =
|
||||
|
||||
/**
|
||||
\rst
|
||||
Constructs a `~fmt::format_arg_store` object that contains references to
|
||||
arguments and can be implicitly converted to `~fmt::format_args`. `Context`
|
||||
can be omitted in which case it defaults to `~fmt::format_context`.
|
||||
See `~fmt::arg` for lifetime considerations.
|
||||
Constructs an object that stores references to arguments and can be implicitly
|
||||
converted to `~fmt::format_args`. `Context` can be omitted in which case it
|
||||
defaults to `~fmt::format_context`. See `~fmt::arg` for lifetime
|
||||
considerations.
|
||||
\endrst
|
||||
*/
|
||||
// Take arguments by lvalue references to avoid some lifetime issues, e.g.
|
||||
@ -2739,7 +2721,8 @@ template <> struct vformat_args<char> {
|
||||
using type = format_args;
|
||||
};
|
||||
|
||||
// Use vformat_args and avoid type_identity to keep symbols short.
|
||||
// Use vformat_args and avoid type_identity, keep symbols short and workaround
|
||||
// a GCC <= 4.8 bug.
|
||||
template <typename Char>
|
||||
void vformat_to(buffer<Char>& buf, basic_string_view<Char> fmt,
|
||||
typename vformat_args<Char>::type args, locale_ref loc = {});
|
||||
|
@ -3969,7 +3969,7 @@ template <typename Char> struct udl_arg {
|
||||
|
||||
template <typename Locale, typename Char>
|
||||
auto vformat(const Locale& loc, basic_string_view<Char> fmt,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||
typename detail::vformat_args<Char>::type args)
|
||||
-> std::basic_string<Char> {
|
||||
auto buf = basic_memory_buffer<Char>();
|
||||
detail::vformat_to(buf, fmt, args, detail::locale_ref(loc));
|
||||
|
@ -193,7 +193,7 @@ inline void vprint_directly(std::ostream& os, string_view format_str,
|
||||
FMT_EXPORT template <typename Char>
|
||||
void vprint(std::basic_ostream<Char>& os,
|
||||
basic_string_view<type_identity_t<Char>> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) {
|
||||
typename detail::vformat_args<Char>::type args) {
|
||||
auto buffer = basic_memory_buffer<Char>();
|
||||
detail::vformat_to(buffer, format_str, args);
|
||||
if (detail::write_ostream_unicode(os, {buffer.data(), buffer.size()})) return;
|
||||
|
@ -586,10 +586,13 @@ inline auto make_wprintf_args(const T&... args)
|
||||
return {args...};
|
||||
}
|
||||
|
||||
template <typename Char> struct vprintf_args {
|
||||
using type = basic_format_args<basic_printf_context<Char>>;
|
||||
};
|
||||
|
||||
template <typename Char>
|
||||
inline auto vsprintf(
|
||||
basic_string_view<Char> fmt,
|
||||
basic_format_args<basic_printf_context<type_identity_t<Char>>> args)
|
||||
inline auto vsprintf(basic_string_view<Char> fmt,
|
||||
typename vprintf_args<Char>::type args)
|
||||
-> std::basic_string<Char> {
|
||||
auto buf = basic_memory_buffer<Char>();
|
||||
detail::vprintf(buf, fmt, args);
|
||||
@ -612,10 +615,8 @@ inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
inline auto vfprintf(
|
||||
std::FILE* f, basic_string_view<Char> fmt,
|
||||
basic_format_args<basic_printf_context<type_identity_t<Char>>> args)
|
||||
-> int {
|
||||
inline auto vfprintf(std::FILE* f, basic_string_view<Char> fmt,
|
||||
typename vprintf_args<Char>::type args) -> int {
|
||||
auto buf = basic_memory_buffer<Char>();
|
||||
detail::vprintf(buf, fmt, args);
|
||||
size_t size = buf.size();
|
||||
@ -640,9 +641,8 @@ inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
|
||||
}
|
||||
|
||||
template <typename Char>
|
||||
FMT_DEPRECATED inline auto vprintf(
|
||||
basic_string_view<Char> fmt,
|
||||
basic_format_args<basic_printf_context<type_identity_t<Char>>> args)
|
||||
FMT_DEPRECATED inline auto vprintf(basic_string_view<Char> fmt,
|
||||
typename vprintf_args<Char>::type args)
|
||||
-> int {
|
||||
return vfprintf(stdout, fmt, args);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ auto join(const std::tuple<T...>& tuple, basic_string_view<wchar_t> sep)
|
||||
|
||||
template <typename Char, FMT_ENABLE_IF(!std::is_same<Char, char>::value)>
|
||||
auto vformat(basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||
typename detail::vformat_args<Char>::type args)
|
||||
-> std::basic_string<Char> {
|
||||
auto buf = basic_memory_buffer<Char>();
|
||||
detail::vformat_to(buf, format_str, args);
|
||||
@ -155,9 +155,8 @@ template <typename Locale, typename S,
|
||||
typename Char = detail::format_string_char_t<S>,
|
||||
FMT_ENABLE_IF(detail::is_locale<Locale>::value&&
|
||||
detail::is_exotic_char<Char>::value)>
|
||||
inline auto vformat(
|
||||
const Locale& loc, const S& format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||
inline auto vformat(const Locale& loc, const S& format_str,
|
||||
typename detail::vformat_args<Char>::type args)
|
||||
-> std::basic_string<Char> {
|
||||
return detail::vformat(loc, detail::to_string_view(format_str), args);
|
||||
}
|
||||
@ -177,8 +176,7 @@ template <typename OutputIt, typename S,
|
||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value&&
|
||||
detail::is_exotic_char<Char>::value)>
|
||||
auto vformat_to(OutputIt out, const S& format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||
-> OutputIt {
|
||||
typename detail::vformat_args<Char>::type args) -> OutputIt {
|
||||
auto&& buf = detail::get_buffer<Char>(out);
|
||||
detail::vformat_to(buf, detail::to_string_view(format_str), args);
|
||||
return detail::get_iterator(buf, out);
|
||||
@ -198,9 +196,9 @@ template <typename Locale, typename S, typename OutputIt, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value&&
|
||||
detail::is_locale<Locale>::value&&
|
||||
detail::is_exotic_char<Char>::value)>
|
||||
inline auto vformat_to(
|
||||
OutputIt out, const Locale& loc, const S& format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args) -> OutputIt {
|
||||
inline auto vformat_to(OutputIt out, const Locale& loc, const S& format_str,
|
||||
typename detail::vformat_args<Char>::type args)
|
||||
-> OutputIt {
|
||||
auto&& buf = detail::get_buffer<Char>(out);
|
||||
vformat_to(buf, detail::to_string_view(format_str), args,
|
||||
detail::locale_ref(loc));
|
||||
@ -222,9 +220,9 @@ inline auto format_to(OutputIt out, const Locale& loc, const S& format_str,
|
||||
template <typename OutputIt, typename Char, typename... Args,
|
||||
FMT_ENABLE_IF(detail::is_output_iterator<OutputIt, Char>::value&&
|
||||
detail::is_exotic_char<Char>::value)>
|
||||
inline auto vformat_to_n(
|
||||
OutputIt out, size_t n, basic_string_view<Char> format_str,
|
||||
basic_format_args<buffer_context<type_identity_t<Char>>> args)
|
||||
inline auto vformat_to_n(OutputIt out, size_t n,
|
||||
basic_string_view<Char> format_str,
|
||||
typename detail::vformat_args<Char>::type args)
|
||||
-> format_to_n_result<OutputIt> {
|
||||
using traits = detail::fixed_buffer_traits;
|
||||
auto buf = detail::iterator_buffer<OutputIt, Char, traits>(out, n);
|
||||
|
Loading…
Reference in New Issue
Block a user