forked from fmtlib/fmt
Make fmt::appender implement std::output_iterator concept (#4093)
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
This commit is contained in:
committed by
GitHub
parent
e23fb6a8b4
commit
aff640c32f
@@ -110,6 +110,7 @@ namespace std {
|
|||||||
template <> struct iterator_traits<fmt::appender> {
|
template <> struct iterator_traits<fmt::appender> {
|
||||||
using iterator_category = output_iterator_tag;
|
using iterator_category = output_iterator_tag;
|
||||||
using value_type = char;
|
using value_type = char;
|
||||||
|
using difference_type = ptrdiff_t;
|
||||||
};
|
};
|
||||||
} // namespace std
|
} // namespace std
|
||||||
|
|
||||||
|
@@ -93,7 +93,7 @@ TEST(string_view_test, compare) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST(base_test, is_locking) {
|
TEST(base_test, is_locking) {
|
||||||
EXPECT_FALSE(fmt::detail::is_locking<const char (&)[3]>());
|
EXPECT_FALSE(fmt::detail::is_locking<const char(&)[3]>());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(base_test, is_output_iterator) {
|
TEST(base_test, is_output_iterator) {
|
||||||
@@ -116,12 +116,6 @@ TEST(base_test, is_back_insert_iterator) {
|
|||||||
std::front_insert_iterator<std::string>>::value);
|
std::front_insert_iterator<std::string>>::value);
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(base_test, buffer_appender) {
|
|
||||||
#ifdef __cpp_lib_ranges
|
|
||||||
EXPECT_TRUE((std::output_iterator<fmt::appender, char>));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 470
|
#if !FMT_GCC_VERSION || FMT_GCC_VERSION >= 470
|
||||||
TEST(buffer_test, noncopyable) {
|
TEST(buffer_test, noncopyable) {
|
||||||
EXPECT_FALSE(std::is_copy_constructible<buffer<char>>::value);
|
EXPECT_FALSE(std::is_copy_constructible<buffer<char>>::value);
|
||||||
|
@@ -26,6 +26,9 @@
|
|||||||
#include <string> // std::string
|
#include <string> // std::string
|
||||||
#include <thread> // std::thread
|
#include <thread> // std::thread
|
||||||
#include <type_traits> // std::is_default_constructible
|
#include <type_traits> // std::is_default_constructible
|
||||||
|
#if FMT_CPLUSPLUS > 201703L && FMT_HAS_INCLUDE(<version>)
|
||||||
|
# include <version>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "gtest-extra.h"
|
#include "gtest-extra.h"
|
||||||
#include "mock-allocator.h"
|
#include "mock-allocator.h"
|
||||||
@@ -42,6 +45,10 @@ using fmt::detail::uint128_fallback;
|
|||||||
using testing::Return;
|
using testing::Return;
|
||||||
using testing::StrictMock;
|
using testing::StrictMock;
|
||||||
|
|
||||||
|
#ifdef __cpp_lib_concepts
|
||||||
|
static_assert(std::output_iterator<fmt::appender, char>);
|
||||||
|
#endif
|
||||||
|
|
||||||
enum { buffer_size = 256 };
|
enum { buffer_size = 256 };
|
||||||
|
|
||||||
TEST(uint128_test, ctor) {
|
TEST(uint128_test, ctor) {
|
||||||
|
Reference in New Issue
Block a user