diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-11 13:20:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-02-11 13:20:12 +0200 |
commit | 36805a538a28f613c11f7889b70740be46447a68 (patch) | |
tree | c9f9e07620d3b6db672fc0a22bc6947c01d2c765 | |
parent | 6ab751a49b1a4336c7f2f109c407fb31c9b69b02 (diff) |
Support compilers that deduce const arrays to const reference differently
-rw-r--r-- | odb/oracle/query.hxx | 35 |
1 files changed, 35 insertions, 0 deletions
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<T, ID> (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 <typename T, std::size_t N> + static val_bind<T[N]> + _val (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return val_bind<T[N]> (x, prec, scale); + } + + template <database_type_id ID, typename T, std::size_t N> + static val_bind_typed<T[N], ID> + _val (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return val_bind_typed<T[N], ID> (x, prec, scale); + } + + template <typename T, std::size_t N> + static ref_bind<T[N]> + _ref (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return ref_bind<T[N]> (x, prec, scale); + } + + template <database_type_id ID, typename T, std::size_t N> + static ref_bind_typed<T[N], ID> + _ref (const T (&x) [N], unsigned short prec = 0xFFF, short scale = 0xFFF) + { + return ref_bind_typed<T[N], ID> (x, prec, scale); + } + public: query_base& operator+= (const query_base&); |