From f7c399e309b9cb68102d37db0f852a9aff10747d Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Thu, 13 Oct 2016 21:10:08 +0200 Subject: [PATCH] Fix overload resolution for vector. --- .../cling/Interpreter/RuntimePrintValue.h | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/interpreter/cling/include/cling/Interpreter/RuntimePrintValue.h b/interpreter/cling/include/cling/Interpreter/RuntimePrintValue.h index 04ae8f396a808..a41c81dc18938 100644 --- a/interpreter/cling/include/cling/Interpreter/RuntimePrintValue.h +++ b/interpreter/cling/include/cling/Interpreter/RuntimePrintValue.h @@ -82,13 +82,21 @@ namespace cling { obj->begin()->first, obj->begin()->second, std::string()); - // Vector, set, deque etc. declaration + // Vector, set, deque etc. declaration. template auto printValue_impl(const CollectionType *obj, int) -> decltype( - ++(obj->begin()), obj->end(), - *(obj->begin()), - std::string()); + ++(obj->begin()), obj->end(), + *(obj->begin()), &(*(obj->begin())), + std::string()); + + // As above, but without ability to take address of elements. + template + auto printValue_impl(const CollectionType *obj, int, ...) + -> decltype( + ++(obj->begin()), obj->end(), + *(obj->begin()), + std::string()); // No general fallback anymore here, void* overload used for that now } @@ -164,9 +172,9 @@ namespace cling { return str + " }"; } - // Vector, set, deque etc. + // As above, but without ability to take address of elements. template - auto printValue_impl(const CollectionType *obj, int) + auto printValue_impl(const CollectionType *obj, int, ...) -> decltype( ++(obj->begin()), obj->end(), *(obj->begin()),