From 7c9b8cad8d850b249b93b5231423284824999d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20Kr=C3=BCger?= Date: Wed, 1 Feb 2017 07:38:28 +0100 Subject: [PATCH] std::vector allocator support --- hdr/sqlite_modern_cpp.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hdr/sqlite_modern_cpp.h b/hdr/sqlite_modern_cpp.h index f74b085b..1d3ea9d1 100644 --- a/hdr/sqlite_modern_cpp.h +++ b/hdr/sqlite_modern_cpp.h @@ -207,8 +207,8 @@ namespace sqlite { || std::is_same::value || std::is_same::value > { }; - template - struct is_sqlite_value< std::vector > : public std::integral_constant< + template + struct is_sqlite_value< std::vector > : public std::integral_constant< bool, std::is_floating_point::value || std::is_integral::value @@ -218,9 +218,9 @@ namespace sqlite { template friend database_binder& operator <<(database_binder& db, const T& val); template friend void get_col_from_db(database_binder& db, int inx, T& val); - /* for vector support */ - template friend database_binder& operator <<(database_binder& db, const std::vector& val); - template friend void get_col_from_db(database_binder& db, int inx, std::vector& val); + /* for vector support */ + template friend database_binder& operator <<(database_binder& db, const std::vector& val); + template friend void get_col_from_db(database_binder& db, int inx, std::vector& val); /* for nullptr & unique_ptr support */ friend database_binder& operator <<(database_binder& db, std::nullptr_t); template friend database_binder& operator <<(database_binder& db, const std::unique_ptr& val); @@ -461,8 +461,8 @@ namespace sqlite { } } - // vector - template inline database_binder& operator<<(database_binder& db, const std::vector& vec) { + // vector + template inline database_binder& operator<<(database_binder& db, const std::vector& vec) { void const* buf = reinterpret_cast(vec.data()); int bytes = vec.size() * sizeof(T); int hresult; @@ -472,13 +472,13 @@ namespace sqlite { ++db._inx; return db; } - template inline void get_col_from_db(database_binder& db, int inx, std::vector& vec) { + template inline void get_col_from_db(database_binder& db, int inx, std::vector& vec) { if(sqlite3_column_type(db._stmt.get(), inx) == SQLITE_NULL) { vec.clear(); } else { int bytes = sqlite3_column_bytes(db._stmt.get(), inx); T const* buf = reinterpret_cast(sqlite3_column_blob(db._stmt.get(), inx)); - vec = std::vector(buf, buf + bytes/sizeof(T)); + vec = std::vector(buf, buf + bytes/sizeof(T)); } }