From 676f6faa92d23c2096a6a85cac819925dbdc1a88 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Mon, 14 Jan 2013 11:41:34 +0200 Subject: [PATCH] Fix an overload resolution problem in formatting values for key_error --- source/core/maputils.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) 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 -- 2.43.0