From 2355231b7ef1adc7352e32d5578641e0279b78a1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Feb 2013 13:20:11 +0200 Subject: Support compilers that deduce const arrays to const reference differently --- odb/query-dynamic.hxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'odb/query-dynamic.hxx') diff --git a/odb/query-dynamic.hxx b/odb/query-dynamic.hxx index acca300..a2779b1 100644 --- a/odb/query-dynamic.hxx +++ b/odb/query-dynamic.hxx @@ -211,6 +211,21 @@ namespace odb return ref_bind (x); } + // Some compilers (notably VC++), when deducing const T& from const + // array do not strip const from the array type. As a result, in the + // above signatures we get, for example, T = const char[4] instead + // of T = char[4], which is what we want. So to "fix" such compilers, + // we will have to provide the following specialization of the above + // _ref() function (we don't need _val() since we don't support passing + // arrays by value; see val_bind definition). + // + template + static ref_bind + _ref (const T (&x) [N]) + { + return ref_bind (x); + } + public: query_base& operator+= (const query_base&); -- cgit v1.1