mirror of
https://github.com/cuberite/SQLiteCpp.git
synced 2025-08-04 17:56:13 -04:00
Fix #130 Statement::getColumns() template function now uses T{} instead of T()
Thanks to @cycycyc for providing this improvement
This commit is contained in:
parent
f08c15f43b
commit
078941cdb1
@ -261,21 +261,23 @@ private:
|
|||||||
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
|
std::ostream& operator<<(std::ostream& aStream, const Column& aColumn);
|
||||||
|
|
||||||
#if __cplusplus >= 201402L || (defined(_MSC_VER) && _MSC_VER >= 1900)
|
#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>
|
// Create an instance of T from the first N columns, see declaration in Statement.h for full details
|
||||||
template<typename T, const int... Is>
|
template<typename T, int N>
|
||||||
T Statement::getColumns(const std::integer_sequence<int, Is...>)
|
T Statement::getColumns()
|
||||||
{
|
{
|
||||||
return T(Column(mStmtPtr, Is)...);
|
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
|
#endif
|
||||||
|
|
||||||
} // namespace SQLite
|
} // namespace SQLite
|
||||||
|
Loading…
x
Reference in New Issue
Block a user