From f913388a1c0257ef03740ad46b7321b2eabf0b2c Mon Sep 17 00:00:00 2001 From: Charles Milette Date: Sun, 15 Dec 2019 16:21:54 -0500 Subject: [PATCH] Template memory_buffer aliases This allows consumers to write something like `fmt::memory_buffer<50>` instead of `fmt::basic_memory_buffer` to save stack space when they know that the result of the formatting cannot be bigger than 50 characters. --- include/fmt/format.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index bec24906..1fad5ab7 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -700,8 +700,11 @@ void basic_memory_buffer::grow(std::size_t size) { if (old_data != store_) Allocator::deallocate(old_data, old_capacity); } -using memory_buffer = basic_memory_buffer; -using wmemory_buffer = basic_memory_buffer; +template> +using memory_buffer = basic_memory_buffer; + +template> +using wmemory_buffer = basic_memory_buffer; /** A formatting error such as invalid format string. */ FMT_CLASS_API