From 36805a538a28f613c11f7889b70740be46447a68 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 11 Feb 2013 13:20:12 +0200 Subject: Support compilers that deduce const arrays to const reference differently --- odb/oracle/query.hxx | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/odb/oracle/query.hxx b/odb/oracle/query.hxx index c6ba413..deb465f 100644 --- a/odb/oracle/query.hxx +++ b/odb/oracle/query.hxx @@ -329,6 +329,41 @@ namespace odb return ref_bind_typed (x, prec, scale); } + // 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 specializations of the above + // functions. + // + template + static val_bind + _val (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return val_bind (x, prec, scale); + } + + template + static val_bind_typed + _val (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return val_bind_typed (x, prec, scale); + } + + template + static ref_bind + _ref (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return ref_bind (x, prec, scale); + } + + template + static ref_bind_typed + _ref (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return ref_bind_typed (x, prec, scale); + } + public: query_base& operator+= (const query_base&); -- cgit v1.1