File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1616#endif
1717#endif
1818
19+ #ifdef __has_include
20+ #if __cplusplus > 201402 && __has_include(<variant>)
21+ #define MODERN_SQLITE_STD_VARIANT_SUPPORT
22+ #endif
23+ #endif
24+
1925#ifdef MODERN_SQLITE_STD_OPTIONAL_SUPPORT
2026#include < optional>
2127#endif
@@ -896,6 +902,14 @@ namespace sqlite {
896902 }
897903#endif
898904
905+ template <typename ...Args> inline database_binder& operator <<(database_binder& db, const std::variant<Args...>& val) {
906+ std::visit ([&](auto &&opt) {db << std::forward<decltype (opt)>(opt);}, val);
907+ return db;
908+ }
909+ template <typename ...Args> inline void store_result_in_db (sqlite3_context* db, const std::variant<Args...>& val) {
910+ std::visit ([&](auto &&opt) {store_result_in_db (db, std::forward<decltype (opt)>(opt));}, val);
911+ }
912+
899913 // Some ppl are lazy so we have a operator for proper prep. statemant handling.
900914 void inline operator ++(database_binder& db, int ) { db.execute (); db.reset (); }
901915
You can’t perform that action at this time.
0 commit comments