#pragma once #include "base/base.hpp" #include "base/macros.hpp" #include #include namespace strings { template std::string ToString(T const & t) { // May be we should use DebugPrint here. Not sure. std::ostringstream out; out << t; return out.str(); } std::string const FormatImpl(std::string const & s, std::string arr[], size_t count); template std::string const Format(std::string const & s, T1 const & t1) { std::string arr[] = { ToString(t1) }; return FormatImpl(s, arr, ARRAY_SIZE(arr)); } template std::string const Format(std::string const & s, T1 const & t1, T2 const & t2) { std::string arr[] = { ToString(t1), ToString(t2) }; return FormatImpl(s, arr, ARRAY_SIZE(arr)); } template std::string const Format(std::string const & s, T1 const & t1, T2 const & t2, T3 const & t3) { std::string arr[] = { ToString(t1), ToString(t2), ToString(t3) }; return FormatImpl(s, arr, ARRAY_SIZE(arr)); } template std::string const Format(std::string const & s, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4) { std::string arr[] = { ToString(t1), ToString(t2), ToString(t3), ToString(t4) }; return FormatImpl(s, arr, ARRAY_SIZE(arr)); } template std::string const Format(std::string const & s, T1 const & t1, T2 const & t2, T3 const & t3, T4 const & t4, T5 const & t5) { std::string arr[] = { ToString(t1), ToString(t2), ToString(t3), ToString(t4), ToString(t5) }; return FormatImpl(s, arr, ARRAY_SIZE(arr)); } }