Replace using with typedef for compatibility with gcc-4.6

This commit is contained in:
Victor Zverovich
2018-02-11 09:23:47 -08:00
parent 9710c058aa
commit affb35cfb9
8 changed files with 63 additions and 49 deletions

View File

@@ -17,9 +17,9 @@ using fmt::printf_arg_formatter;
class CustomArgFormatter :
public fmt::arg_formatter<fmt::back_insert_range<fmt::internal::buffer>> {
public:
using range = fmt::back_insert_range<fmt::internal::buffer>;
using iterator = decltype(std::declval<range>().begin());
using base = fmt::arg_formatter<range>;
typedef fmt::back_insert_range<fmt::internal::buffer> range;
typedef decltype(std::declval<range>().begin()) iterator;
typedef fmt::arg_formatter<range> base;
CustomArgFormatter(fmt::basic_context<iterator, char> &ctx,
fmt::format_specs &s)

View File

@@ -89,7 +89,7 @@ void std_format(long double value, std::wstring &result) {
template <typename Char, typename T>
::testing::AssertionResult check_write(const T &value, const char *type) {
fmt::basic_memory_buffer<Char> buffer;
using range = fmt::back_insert_range<fmt::internal::basic_buffer<Char>>;
typedef fmt::back_insert_range<fmt::internal::basic_buffer<Char>> range;
fmt::basic_writer<range> writer(buffer);
writer.write(value);
std::basic_string<Char> actual = to_string(buffer);
@@ -1516,7 +1516,7 @@ TEST(FormatTest, FixedEnum) {
}
#endif
using buffer_range = fmt::back_insert_range<fmt::internal::buffer>;
typedef fmt::back_insert_range<fmt::internal::buffer> buffer_range;
class mock_arg_formatter :
public fmt::internal::arg_formatter_base<buffer_range> {
@@ -1524,8 +1524,8 @@ class mock_arg_formatter :
MOCK_METHOD1(call, void (int value));
public:
using base = fmt::internal::arg_formatter_base<buffer_range>;
using range = buffer_range;
typedef fmt::internal::arg_formatter_base<buffer_range> 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<test_context> next_arg() {
return fmt::internal::make_arg<test_context>(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, "");

View File

@@ -58,7 +58,7 @@ TEST(OStreamTest, Enum) {
EXPECT_EQ("0", fmt::format("{}", A));
}
using range = fmt::back_insert_range<fmt::internal::buffer>;
typedef fmt::back_insert_range<fmt::internal::buffer> range;
struct test_arg_formatter: fmt::arg_formatter<range> {
test_arg_formatter(fmt::context &ctx, fmt::format_specs &s)

View File

@@ -81,7 +81,7 @@ struct formatter<Test, Char> {
return ctx.begin();
}
using iterator = std::back_insert_iterator<basic_buffer<Char>>;
typedef std::back_insert_iterator<basic_buffer<Char>> iterator;
auto format(Test, basic_context<iterator, char> &ctx)
-> decltype(ctx.begin()) {
@@ -436,7 +436,7 @@ TEST(UtilTest, FormatArgs) {
}
struct custom_context {
using char_type = char;
typedef char char_type;
template <typename T>
struct formatter_type {
@@ -525,7 +525,7 @@ VISIT_TYPE(float, double);
#define CHECK_ARG_(Char, expected, value) { \
testing::StrictMock<MockVisitor<decltype(expected)>> visitor; \
EXPECT_CALL(visitor, visit(expected)); \
using iterator = std::back_insert_iterator<basic_buffer<Char>>; \
typedef std::back_insert_iterator<basic_buffer<Char>> iterator; \
fmt::visit(visitor, make_arg<fmt::basic_context<iterator, Char>>(value)); \
}
@@ -599,8 +599,8 @@ TEST(UtilTest, PointerArg) {
TEST(UtilTest, CustomArg) {
::Test test;
using handle = typename fmt::basic_arg<fmt::context>::handle;
using visitor = MockVisitor<handle>;
typedef typename fmt::basic_arg<fmt::context>::handle handle;
typedef MockVisitor<handle> visitor;
testing::StrictMock<visitor> v;
EXPECT_CALL(v, visit(_)).WillOnce(testing::Invoke([&](handle h) {
fmt::memory_buffer buffer;