Template memory_buffer aliases

This allows consumers to write something like `fmt::memory_buffer<50>` instead of `fmt::basic_memory_buffer<char, 50>` to save stack space when they know that the result of the formatting cannot be bigger than 50 characters.
This commit is contained in:
Charles Milette 2019-12-15 16:21:54 -05:00 committed by GitHub
parent 35959a31d7
commit f913388a1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -700,8 +700,11 @@ void basic_memory_buffer<T, SIZE, Allocator>::grow(std::size_t size) {
if (old_data != store_) Allocator::deallocate(old_data, old_capacity);
}
using memory_buffer = basic_memory_buffer<char>;
using wmemory_buffer = basic_memory_buffer<wchar_t>;
template<std::size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
using memory_buffer = basic_memory_buffer<char, SIZE, Allocator>;
template<std::size_t SIZE = inline_buffer_size, typename Allocator = std::allocator<T>>
using wmemory_buffer = basic_memory_buffer<wchar_t, SIZE, Allocator>;
/** A formatting error such as invalid format string. */
FMT_CLASS_API