From ab7ef47a375da5b010f37605ba79a92babbebbc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=CC=81rton=20Dano=CC=81czy?= Date: Wed, 29 Oct 2014 12:18:16 +0100 Subject: [PATCH] Added an overload taking string literals to BasicStringRef --- format.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/format.h b/format.h index 31325524..cf450bdf 100644 --- a/format.h +++ b/format.h @@ -172,7 +172,14 @@ class BasicStringRef { If *size* is zero, which is the default, the size is computed automatically. */ - BasicStringRef(const Char *s, std::size_t size = 0) : data_(s), size_(size) {} + BasicStringRef(const Char* const& s, std::size_t size = 0) : data_(s), size_(size) {} + + /** + Constructs a string reference object from a C string literal, + if its size is determinable at compile time. + */ + template + BasicStringRef(const Char (&s) [N]) : data_(s), size_(N) {} /** Constructs a string reference from an `std::string` object.