From: Mikko Rasa Date: Mon, 14 Jan 2013 09:41:34 +0000 (+0200) Subject: Fix an overload resolution problem in formatting values for key_error X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=676f6faa92d23c2096a6a85cac819925dbdc1a88;p=libs%2Fcore.git Fix an overload resolution problem in formatting values for key_error --- diff --git a/source/core/maputils.h b/source/core/maputils.h index 8c642fb..0f863b4 100644 --- a/source/core/maputils.h +++ b/source/core/maputils.h @@ -9,11 +9,17 @@ namespace Msp { namespace MapUtilsInternal { +/* This dummy struct is used to introduce a conversion, making the overloaded +operator below worse than the templated one provided in lexicalcast.h. */ +struct Any +{ + template + Any(const T &) { } +}; + /* This must be hidden in the internal namespace to avoid interfering with -other things. There may be problems if a key type has operator<< for ostream -but not LexicalConverter. */ -template -void operator<<(LexicalConverter &, const T &) +other things. */ +inline void operator<<(LexicalConverter &, Any) { } template