From 19361dac55271800d9646aad9bc860e15738ab4b Mon Sep 17 00:00:00 2001 From: Petter Strandmark Date: Thu, 13 Mar 2014 23:49:20 +0100 Subject: [PATCH] Clang fix: function order in string_utils.h. --- include/spii/string_utils.h | 62 ++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/include/spii/string_utils.h b/include/spii/string_utils.h index 5451740..5229742 100644 --- a/include/spii/string_utils.h +++ b/include/spii/string_utils.h @@ -32,38 +32,8 @@ namespace spii // and combinations thereof, e.g. vector>. namespace { - void add_to_stream(std::ostream*) - { } - - template - void add_to_stream(std::ostream* stream, T&& t, Args&&... args) - { - (*stream) << std::forward(t); - add_to_stream(stream, std::forward(args)...); - } - - std::string to_string() - { - return{}; - } - - // Overload for string literals. - template - std::string to_string(const char(&c_str)[n]) - { - return{c_str}; - } - - template - std::string to_string(Args&&... args) - { - std::ostringstream stream; - add_to_stream(&stream, std::forward(args)...); - return stream.str(); - } - template - std::ostream& operator<<(std::ostream& stream, std::pair p) + std::ostream& operator<<(std::ostream& stream, const std::pair& p) { stream << '(' << p.first << ", " << p.second << ')'; return stream; @@ -140,6 +110,36 @@ namespace { stream << ']'; return stream; } + + void add_to_stream(std::ostream*) + { } + + template + void add_to_stream(std::ostream* stream, T&& t, Args&&... args) + { + (*stream) << std::forward(t); + add_to_stream(stream, std::forward(args)...); + } + + std::string to_string() + { + return{}; + } + + // Overload for string literals. + template + std::string to_string(const char(&c_str)[n]) + { + return{c_str}; + } + + template + std::string to_string(Args&&... args) + { + std::ostringstream stream; + add_to_stream(&stream, std::forward(args)...); + return stream.str(); + } } template