aboutsummaryrefslogtreecommitdiff
path: root/odb/query-dynamic.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-02-11 13:20:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-02-11 13:20:11 +0200
commit2355231b7ef1adc7352e32d5578641e0279b78a1 (patch)
tree48459b5e368822a8947be82f7d9dc1ba50f6d6c5 /odb/query-dynamic.hxx
parent0aed6b569861349a578fd2daecf067dc9197915e (diff)
Support compilers that deduce const arrays to const reference differently
Diffstat (limited to 'odb/query-dynamic.hxx')
-rw-r--r--odb/query-dynamic.hxx15
1 files changed, 15 insertions, 0 deletions
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<T> (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 <typename T, std::size_t N>
+ static ref_bind<T[N]>
+ _ref (const T (&x) [N])
+ {
+ return ref_bind<T[N]> (x);
+ }
+
public:
query_base&
operator+= (const query_base&);