Skip to content

Commit 078941c

Browse files
committed
Fix #130 Statement::getColumns() template function now uses T{} instead of T()
Thanks to @cycycyc for providing this improvement
1 parent f08c15f commit 078941c

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

include/SQLiteCpp/Column.h

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -261,21 +261,23 @@ class Column
261261
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
262262

263263
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900)
264-
// Create an instance of T from the first N columns, see declaration in Statement.h for full details
265-
template<typename T, int N>
266-
T Statement::getColumns()
267-
{
268-
checkRow();
269-
checkIndex(N - 1);
270-
return getColumns<T>(std::make_integer_sequence<int, N>{});
271-
}
272264

273-
// Helper function called by getColums<typename T, int N>
274-
template<typename T, const int... Is>
275-
T Statement::getColumns(const std::integer_sequence<int, Is...>)
276-
{
277-
return T(Column(mStmtPtr, Is)...);
278-
}
265+
// Create an instance of T from the first N columns, see declaration in Statement.h for full details
266+
template<typename T, int N>
267+
T Statement::getColumns()
268+
{
269+
checkRow();
270+
checkIndex(N - 1);
271+
return getColumns<T>(std::make_integer_sequence<int, N>{});
272+
}
273+
274+
// Helper function called by getColums<typename T, int N>
275+
template<typename T, const int... Is>
276+
T Statement::getColumns(const std::integer_sequence<int, Is...>)
277+
{
278+
return T{Column(mStmtPtr, Is)...};
279+
}
280+
279281
#endif
280282

281283
} // namespace SQLite

0 commit comments

Comments
 (0)