Make truncating_iterator an output_iterator (#2158)
This commit is contained in:
@@ -12,9 +12,11 @@
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <iterator>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
// Check if fmt/format.h compiles with windows.h included before it.
|
||||
#ifdef _WIN32
|
||||
@@ -157,6 +159,24 @@ TEST(IteratorTest, TruncatingIterator) {
|
||||
EXPECT_EQ(it.base(), p + 1);
|
||||
}
|
||||
|
||||
|
||||
TEST(IteratorTest, TruncatingIteratorDefaultConstruct) {
|
||||
static_assert(
|
||||
std::is_default_constructible<fmt::detail::truncating_iterator<char*>>::value,
|
||||
"");
|
||||
|
||||
fmt::detail::truncating_iterator<char*> it;
|
||||
EXPECT_EQ(nullptr, it.base());
|
||||
EXPECT_EQ(std::size_t{0}, it.count());
|
||||
}
|
||||
|
||||
#ifdef __cpp_lib_ranges
|
||||
TEST(IteratorTest, TruncatingIteratorOutputIterator) {
|
||||
static_assert(std::output_iterator<fmt::detail::truncating_iterator<char*>,
|
||||
char>);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST(IteratorTest, TruncatingBackInserter) {
|
||||
std::string buffer;
|
||||
auto bi = std::back_inserter(buffer);
|
||||
|
||||
Reference in New Issue
Block a user