Skip to content
Permalink
Browse files

Fix #130 Statement::getColumns() template function now uses T{} inste…

…ad of T()

Thanks to @cycycyc for providing this improvement
  • Loading branch information...
SRombauts committed Jul 17, 2017
1 parent f08c15f commit 078941cdb1ec87f5107b3ae276740aa9bf5fb0fb
Showing with 16 additions and 14 deletions.
  1. +16 −14 include/SQLiteCpp/Column.h
@@ -261,21 +261,23 @@ class Column
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<typename T, int N>
T Statement::getColumns()
{
checkRow();
checkIndex(N - 1);
return getColumns<T>(std::make_integer_sequence<int, N>{});
}

// Helper function called by getColums<typename T, int N>
template<typename T, const int... Is>
T Statement::getColumns(const std::integer_sequence<int, Is...>)
{
return T(Column(mStmtPtr, Is)...);
}
// Create an instance of T from the first N columns, see declaration in Statement.h for full details
template<typename T, int N>
T Statement::getColumns()
{
checkRow();
checkIndex(N - 1);
return getColumns<T>(std::make_integer_sequence<int, N>{});
}

// Helper function called by getColums<typename T, int N>
template<typename T, const int... Is>
T Statement::getColumns(const std::integer_sequence<int, Is...>)
{
return T{Column(mStmtPtr, Is)...};
}

#endif

} // namespace SQLite

0 comments on commit 078941c

Please sign in to comment.
You can’t perform that action at this time.