Add inline namespace fmt::v5

This commit is contained in:
Victor Zverovich
2018-05-12 08:33:51 -07:00
parent b64b24ebc5
commit 838400d29b
12 changed files with 73 additions and 61 deletions

View File

@@ -1090,7 +1090,7 @@ TEST(FormatterTest, FormatConvertibleToStringView) {
EXPECT_EQ("foo", format("{}", ConvertibleToStringView()));
}
namespace fmt {
FMT_BEGIN_NAMESPACE
template <>
struct formatter<Date> {
template <typename ParseContext>
@@ -1106,7 +1106,7 @@ struct formatter<Date> {
return ctx.out();
}
};
}
FMT_END_NAMESPACE
TEST(FormatterTest, FormatCustom) {
Date date(2012, 12, 9);
@@ -1116,14 +1116,14 @@ TEST(FormatterTest, FormatCustom) {
class Answer {};
namespace fmt {
FMT_BEGIN_NAMESPACE
template <>
struct formatter<Answer> : formatter<int> {
auto format(Answer, fmt::format_context &ctx) -> decltype(ctx.out()) {
return formatter<int>::format(42, ctx);
}
};
}
FMT_END_NAMESPACE
TEST(FormatterTest, CustomFormat) {
EXPECT_EQ("42", format("{0}", Answer()));
@@ -1455,7 +1455,7 @@ struct variant {
explicit variant(const char *) : type(STRING) {}
};
namespace fmt {
FMT_BEGIN_NAMESPACE
template <>
struct formatter<variant> : dynamic_formatter<> {
auto format(variant value, format_context& ctx) -> decltype(ctx.out()) {
@@ -1464,7 +1464,7 @@ struct formatter<variant> : dynamic_formatter<> {
return dynamic_formatter<>::format("foo", ctx);
}
};
}
FMT_END_NAMESPACE
TEST(FormatTest, DynamicFormatter) {
auto num = variant(42);

View File

@@ -54,7 +54,7 @@ basic_format_arg<Context> make_arg(const T &value) {
}
} // namespace
namespace fmt {
FMT_BEGIN_NAMESPACE
template <typename Char>
struct formatter<Test, Char> {
template <typename ParseContext>
@@ -70,7 +70,7 @@ struct formatter<Test, Char> {
return std::copy_n(test, std::strlen(test), ctx.out());
}
};
}
FMT_END_NAMESPACE
void CheckForwarding(
MockAllocator<int> &alloc, AllocatorRef< MockAllocator<int> > &ref) {
@@ -459,7 +459,7 @@ TEST(UtilTest, MakeValueWithCustomFormatter) {
EXPECT_TRUE(ctx.called);
}
namespace fmt {
FMT_BEGIN_NAMESPACE
namespace internal {
template <typename Char>
@@ -467,7 +467,7 @@ bool operator==(custom_value<Char> lhs, custom_value<Char> rhs) {
return lhs.value == rhs.value;
}
}
}
FMT_END_NAMESPACE
// Use a unique result type to make sure that there are no undesirable
// conversions.