diff --git a/include/fmt/core.h b/include/fmt/core.h index 4e14bced..0079b598 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -854,10 +854,12 @@ class basic_context : }; template -using buffer_context_t = basic_context< - std::back_insert_iterator>, Char>; -typedef buffer_context_t context; -typedef buffer_context_t wcontext; +struct buffer_context { + typedef basic_context< + std::back_insert_iterator>, Char> type; +}; +typedef buffer_context::type context; +typedef buffer_context::type wcontext; namespace internal { template diff --git a/include/fmt/format.h b/include/fmt/format.h index 651ddabf..91cf5ab1 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2919,8 +2919,8 @@ inline void format_decimal(char *&buffer, T value) { template struct formatter< T, Char, - typename std::enable_if< - internal::format_type, T>::value>::type> { + typename std::enable_if::type, T>::value>::type> { // Parses format specifiers stopping either at the end of the range or at the // terminating '}'. @@ -2928,7 +2928,8 @@ struct formatter< FMT_CONSTEXPR typename ParseContext::iterator parse(ParseContext &ctx) { auto it = internal::null_terminating_iterator(ctx); typedef internal::dynamic_specs_handler handler_type; - auto type = internal::get_type, T>::value; + auto type = internal::get_type< + typename buffer_context::type, T>::value; internal::specs_checker handler(handler_type(specs_, ctx), type); it = parse_format_specs(it, handler); @@ -3283,14 +3284,18 @@ inline void format_to(wmemory_buffer &buf, wstring_view format_str, } template -using context_t = basic_context; +//using context_t = basic_context; +struct context_t { typedef basic_context type; }; template -using format_args_t = basic_format_args>; +//using format_args_t = basic_format_args>; +struct format_args_t { + typedef basic_format_args::type> type; +}; template inline OutputIt vformat_to(OutputIt out, string_view format_str, - format_args_t args) { + typename format_args_t::type args) { typedef output_range range; return do_vformat_to>(range(out), format_str, args); } @@ -3298,7 +3303,8 @@ inline OutputIt vformat_to(OutputIt out, string_view format_str, template inline OutputIt format_to(OutputIt out, string_view format_str, const Args & ... args) { - return vformat_to(out, format_str, *make_args>(args...)); + return vformat_to(out, format_str, + *make_args::type>(args...)); } template diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index c93b82ed..922be754 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -104,8 +104,8 @@ struct format_enum struct formatter, T>::value>::type> + typename std::enable_if::type, T>::value>::type> : formatter, Char> { template diff --git a/include/fmt/printf.h b/include/fmt/printf.h index f25a8b64..531f6864 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -73,7 +73,7 @@ struct make_unsigned_or_bool : std::make_unsigned {}; template <> struct make_unsigned_or_bool { - using type = bool; + typedef bool type; }; template @@ -215,10 +215,10 @@ class basic_printf_context; template class printf_arg_formatter : public internal::arg_formatter_base { private: - using char_type = typename Range::value_type; - using iterator = decltype(std::declval().begin()); - using base = internal::arg_formatter_base; - using context_type = basic_printf_context; + typedef typename Range::value_type char_type; + typedef decltype(std::declval().begin()) iterator; + typedef internal::arg_formatter_base base; + typedef basic_printf_context context_type; context_type &context_; @@ -228,7 +228,7 @@ class printf_arg_formatter : public internal::arg_formatter_base { } public: - using format_specs = typename base::format_specs; + typedef typename base::format_specs format_specs; /** \rst @@ -306,16 +306,16 @@ class basic_printf_context : OutputIt, basic_printf_context, Char> { public: /** The character type for the output. */ - using char_type = Char; + typedef Char char_type; template struct formatter_type { typedef printf_formatter type; }; private: - using base = internal::context_base; - using format_arg = typename base::format_arg; - using format_specs = basic_format_specs; - using iterator = internal::null_terminating_iterator; + typedef internal::context_base base; + typedef typename base::format_arg format_arg; + typedef basic_format_specs format_specs; + typedef internal::null_terminating_iterator iterator; void parse_flags(format_specs &spec, iterator &it); @@ -534,10 +534,13 @@ void printf(internal::basic_buffer &buf, basic_string_view format, } template -using printf_context = basic_printf_context< - std::back_insert_iterator, typename Buffer::value_type>; +struct printf_context { + typedef basic_printf_context< + std::back_insert_iterator, typename Buffer::value_type> type; +}; -using printf_args = basic_format_args>; +typedef basic_format_args< + typename printf_context::type> printf_args; inline std::string vsprintf(string_view format, printf_args args) { memory_buffer buffer; @@ -557,12 +560,12 @@ inline std::string vsprintf(string_view format, printf_args args) { template inline std::string sprintf(string_view format_str, const Args & ... args) { return vsprintf(format_str, - make_args>(args...)); + make_args::type>(args...)); } inline std::wstring vsprintf( wstring_view format, - basic_format_args> args) { + basic_format_args::type> args) { wmemory_buffer buffer; printf(buffer, format, args); return to_string(buffer); @@ -570,7 +573,8 @@ inline std::wstring vsprintf( template inline std::wstring sprintf(wstring_view format_str, const Args & ... args) { - auto vargs = make_args>(args...); + auto vargs = make_args< + typename printf_context::type>(args...); return vsprintf(format_str, vargs); } @@ -593,7 +597,8 @@ inline int vfprintf(std::FILE *f, string_view format, printf_args args) { */ template inline int fprintf(std::FILE *f, string_view format_str, const Args & ... args) { - auto vargs = make_args>(args...); + auto vargs = make_args< + typename printf_context::type>(args...); return vfprintf(f, format_str, vargs); } @@ -613,7 +618,7 @@ inline int vprintf(string_view format, printf_args args) { template inline int printf(string_view format_str, const Args & ... args) { return vprintf(format_str, - make_args>(args...)); + make_args::type>(args...)); } inline int vfprintf(std::ostream &os, string_view format_str, @@ -636,7 +641,8 @@ inline int vfprintf(std::ostream &os, string_view format_str, template inline int fprintf(std::ostream &os, string_view format_str, const Args & ... args) { - auto vargs = make_args>(args...); + auto vargs = make_args< + typename printf_context::type>(args...); return vfprintf(os, format_str, vargs); } } // namespace fmt diff --git a/test/custom-formatter-test.cc b/test/custom-formatter-test.cc index d44f7002..d8be5375 100644 --- a/test/custom-formatter-test.cc +++ b/test/custom-formatter-test.cc @@ -17,9 +17,9 @@ using fmt::printf_arg_formatter; class CustomArgFormatter : public fmt::arg_formatter> { public: - using range = fmt::back_insert_range; - using iterator = decltype(std::declval().begin()); - using base = fmt::arg_formatter; + typedef fmt::back_insert_range range; + typedef decltype(std::declval().begin()) iterator; + typedef fmt::arg_formatter base; CustomArgFormatter(fmt::basic_context &ctx, fmt::format_specs &s) diff --git a/test/format-test.cc b/test/format-test.cc index 54fe79ac..b7093e3d 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -89,7 +89,7 @@ void std_format(long double value, std::wstring &result) { template ::testing::AssertionResult check_write(const T &value, const char *type) { fmt::basic_memory_buffer buffer; - using range = fmt::back_insert_range>; + typedef fmt::back_insert_range> range; fmt::basic_writer writer(buffer); writer.write(value); std::basic_string actual = to_string(buffer); @@ -1516,7 +1516,7 @@ TEST(FormatTest, FixedEnum) { } #endif -using buffer_range = fmt::back_insert_range; +typedef fmt::back_insert_range buffer_range; class mock_arg_formatter : public fmt::internal::arg_formatter_base { @@ -1524,8 +1524,8 @@ class mock_arg_formatter : MOCK_METHOD1(call, void (int value)); public: - using base = fmt::internal::arg_formatter_base; - using range = buffer_range; + typedef fmt::internal::arg_formatter_base base; + typedef buffer_range range; mock_arg_formatter(fmt::context &ctx, fmt::format_specs &s) : base(fmt::internal::get_container(ctx.begin()), s) { @@ -1719,7 +1719,7 @@ FMT_CONSTEXPR test_format_specs_handler parse_test_specs(const char *s) { } TEST(FormatTest, ConstexprParseFormatSpecs) { - using handler = test_format_specs_handler; + typedef test_format_specs_handler handler; static_assert(parse_test_specs("<").align == fmt::ALIGN_LEFT, ""); static_assert(parse_test_specs("*^").fill == '*', ""); static_assert(parse_test_specs("+").res == handler::PLUS, ""); @@ -1736,7 +1736,7 @@ TEST(FormatTest, ConstexprParseFormatSpecs) { } struct test_context { - using char_type = char; + typedef char char_type; FMT_CONSTEXPR fmt::basic_arg next_arg() { return fmt::internal::make_arg(11); @@ -1817,7 +1817,7 @@ FMT_CONSTEXPR test_format_specs_handler check_specs(const char *s) { } TEST(FormatTest, ConstexprSpecsChecker) { - using handler = test_format_specs_handler; + typedef test_format_specs_handler handler; static_assert(check_specs("<").align == fmt::ALIGN_LEFT, ""); static_assert(check_specs("*^").fill == '*', ""); static_assert(check_specs("+").res == handler::PLUS, ""); diff --git a/test/ostream-test.cc b/test/ostream-test.cc index 1a0656f5..e42f3344 100644 --- a/test/ostream-test.cc +++ b/test/ostream-test.cc @@ -58,7 +58,7 @@ TEST(OStreamTest, Enum) { EXPECT_EQ("0", fmt::format("{}", A)); } -using range = fmt::back_insert_range; +typedef fmt::back_insert_range range; struct test_arg_formatter: fmt::arg_formatter { test_arg_formatter(fmt::context &ctx, fmt::format_specs &s) diff --git a/test/util-test.cc b/test/util-test.cc index 54296a74..5ada007b 100644 --- a/test/util-test.cc +++ b/test/util-test.cc @@ -81,7 +81,7 @@ struct formatter { return ctx.begin(); } - using iterator = std::back_insert_iterator>; + typedef std::back_insert_iterator> iterator; auto format(Test, basic_context &ctx) -> decltype(ctx.begin()) { @@ -436,7 +436,7 @@ TEST(UtilTest, FormatArgs) { } struct custom_context { - using char_type = char; + typedef char char_type; template struct formatter_type { @@ -525,7 +525,7 @@ VISIT_TYPE(float, double); #define CHECK_ARG_(Char, expected, value) { \ testing::StrictMock> visitor; \ EXPECT_CALL(visitor, visit(expected)); \ - using iterator = std::back_insert_iterator>; \ + typedef std::back_insert_iterator> iterator; \ fmt::visit(visitor, make_arg>(value)); \ } @@ -599,8 +599,8 @@ TEST(UtilTest, PointerArg) { TEST(UtilTest, CustomArg) { ::Test test; - using handle = typename fmt::basic_arg::handle; - using visitor = MockVisitor; + typedef typename fmt::basic_arg::handle handle; + typedef MockVisitor visitor; testing::StrictMock v; EXPECT_CALL(v, visit(_)).WillOnce(testing::Invoke([&](handle h) { fmt::memory_buffer buffer;