From 078941cdb1ec87f5107b3ae276740aa9bf5fb0fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Rombauts?= Date: Mon, 17 Jul 2017 15:26:02 +0200 Subject: [PATCH] Fix #130 Statement::getColumns() template function now uses T{} instead of T() Thanks to @cycycyc for providing this improvement --- include/SQLiteCpp/Column.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/include/SQLiteCpp/Column.h b/include/SQLiteCpp/Column.h index be0babc..041a9a9 100644 --- a/include/SQLiteCpp/Column.h +++ b/include/SQLiteCpp/Column.h @@ -261,21 +261,23 @@ private: std::ostream& operator<<(std::ostream& aStream, const Column& aColumn); #if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900) - // Create an instance of T from the first N columns, see declaration in Statement.h for full details - template - T Statement::getColumns() - { - checkRow(); - checkIndex(N - 1); - return getColumns(std::make_integer_sequence{}); - } - // Helper function called by getColums - template - T Statement::getColumns(const std::integer_sequence) - { - return T(Column(mStmtPtr, Is)...); - } +// Create an instance of T from the first N columns, see declaration in Statement.h for full details +template +T Statement::getColumns() +{ + checkRow(); + checkIndex(N - 1); + return getColumns(std::make_integer_sequence{}); +} + +// Helper function called by getColums +template +T Statement::getColumns(const std::integer_sequence) +{ + return T{Column(mStmtPtr, Is)...}; +} + #endif } // namespace SQLite