summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-07 20:59:31 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-07 20:59:31 +0100
commitdd8c4ed3e1e6f1a9bee802b92381d8ac2154ffad (patch)
tree9de3e8ced05c773f9e363e2f5dfa3291dadea3c9
parentAdd RecordSet RowView (diff)
downloadmygrate-dd8c4ed3e1e6f1a9bee802b92381d8ac2154ffad.tar.bz2
mygrate-dd8c4ed3e1e6f1a9bee802b92381d8ac2154ffad.tar.xz
mygrate-dd8c4ed3e1e6f1a9bee802b92381d8ac2154ffad.zip
Simplify and allow offset when creating objects from rows
-rw-r--r--lib/dbRecordSet.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/dbRecordSet.h b/lib/dbRecordSet.h
index 5bd6967..c84bb46 100644
--- a/lib/dbRecordSet.h
+++ b/lib/dbRecordSet.h
@@ -13,16 +13,16 @@ namespace MyGrate {
DbValue operator[](std::size_t col) const;
- template<typename S, std::size_t N, typename Indices = std::make_index_sequence<N>>
+ template<typename S, std::size_t N, std::size_t O = 0>
auto
create() const
{
- return create<S>(Indices {});
+ return create<S, O>(std::make_index_sequence<N> {});
}
- template<typename S, std::size_t... I> auto create(std::index_sequence<I...>) const
+ template<typename S, std::size_t O, std::size_t... I> auto create(std::index_sequence<I...>) const
{
- return std::make_unique<S>((*this)[I]...);
+ return std::make_unique<S>((*this)[I + O]...);
}
private: