summaryrefslogtreecommitdiff
path: root/libdbpp/selectcommand.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2018-08-22 19:47:53 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2018-08-22 19:47:53 +0100
commitb932b50414c806f2fa590a01ccf3cfd94d27165f (patch)
treea8fb07a7b3113b1fb79639a034c8cb284f33c138 /libdbpp/selectcommand.h
parentWorkaround Clang warning about evaluation with typeid (diff)
downloadlibdbpp-b932b50414c806f2fa590a01ccf3cfd94d27165f.tar.bz2
libdbpp-b932b50414c806f2fa590a01ccf3cfd94d27165f.tar.xz
libdbpp-b932b50414c806f2fa590a01ccf3cfd94d27165f.zip
Structured binding
Replace Row::value method with one that supports structured binding of field values
Diffstat (limited to 'libdbpp/selectcommand.h')
-rw-r--r--libdbpp/selectcommand.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/libdbpp/selectcommand.h b/libdbpp/selectcommand.h
index 0d2a4ca..ee4c9ad 100644
--- a/libdbpp/selectcommand.h
+++ b/libdbpp/selectcommand.h
@@ -13,6 +13,12 @@
#include <visibility.h>
#include <exception.h>
+#ifndef BOOST_TEST_MODULE
+#define DEPRECATE __attribute__((deprecated))
+#else
+#define DEPRECATE
+#endif
+
namespace DB {
class Column;
class SelectCommand;
@@ -38,7 +44,10 @@ namespace DB {
/// Get value of column C in current row.
template<unsigned int C>
- typename std::tuple_element<C, std::tuple<Fn...>>::type value() const;
+ typename std::tuple_element<C, std::tuple<Fn...>>::type value() const DEPRECATE ;
+
+ template<unsigned int C>
+ typename std::tuple_element<C, std::tuple<Fn...>>::type get() const;
};
template<typename ... Fn>
@@ -137,5 +146,14 @@ namespace DB {
};
}
+namespace std {
+ template<typename ... Fn> struct tuple_size<DB::Row<Fn...>> {
+ static constexpr auto value = sizeof...(Fn);
+ };
+ template<size_t C, typename ... Fn> struct tuple_element<C, DB::Row<Fn...>> {
+ typedef typename std::tuple_element<C, std::tuple<Fn...>>::type type;
+ };
+}
+
#endif