mirror of
https://github.com/fmtlib/fmt.git
synced 2025-06-25 01:11:40 +02:00
Fix ADL lookup for memory_buffer
This commit is contained in:
@ -738,8 +738,9 @@ using is_double_double = bool_constant<std::numeric_limits<T>::digits == 106>;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// An allocator that uses malloc/free to allow removing dependency on the C++
|
// An allocator that uses malloc/free to allow removing dependency on the C++
|
||||||
// standard libary runtime.
|
// standard libary runtime. std::decay is used for back_inserter to be found by
|
||||||
template <typename T> struct allocator {
|
// ADL when applied to memory_buffer.
|
||||||
|
template <typename T> struct allocator : private std::decay<void> {
|
||||||
using value_type = T;
|
using value_type = T;
|
||||||
|
|
||||||
T* allocate(size_t n) {
|
T* allocate(size_t n) {
|
||||||
|
@ -481,6 +481,12 @@ TEST(memory_buffer_test, max_size_allocator_overflow) {
|
|||||||
EXPECT_THROW(buffer.resize(161), std::exception);
|
EXPECT_THROW(buffer.resize(161), std::exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(memory_buffer_test, back_insert_iterator) {
|
||||||
|
fmt::memory_buffer buf;
|
||||||
|
using iterator = decltype(std::back_inserter(buf));
|
||||||
|
EXPECT_TRUE(fmt::detail::is_back_insert_iterator<iterator>::value);
|
||||||
|
}
|
||||||
|
|
||||||
TEST(format_test, digits2_alignment) {
|
TEST(format_test, digits2_alignment) {
|
||||||
auto p =
|
auto p =
|
||||||
fmt::detail::bit_cast<fmt::detail::uintptr_t>(fmt::detail::digits2(0));
|
fmt::detail::bit_cast<fmt::detail::uintptr_t>(fmt::detail::digits2(0));
|
||||||
|
Reference in New Issue
Block a user