Skip to content

Commit 1d7747f

Browse files
committed
Fixes compiling with Visual Studio
Fixes #78
1 parent 040fe9c commit 1d7747f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

hdr/sqlite_modern_cpp.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
#include <memory>
99
#include <vector>
1010

11+
#ifdef __has_include
1112
#if __has_include(<optional>)
13+
#define _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
14+
#endif
15+
#endif
16+
17+
#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
1218
#include <optional>
1319
#endif
1420

@@ -241,7 +247,7 @@ namespace sqlite {
241247
friend database_binder& operator <<(database_binder& db, const std::u16string& txt);
242248

243249

244-
#if __has_include(<optional>)
250+
#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
245251
template <typename OptionalT> friend database_binder& operator <<(database_binder& db, const std::optional<OptionalT>& val);
246252
template <typename OptionalT> friend void get_col_from_db(database_binder& db, int inx, std::optional<OptionalT>& o);
247253
#endif
@@ -555,7 +561,7 @@ namespace sqlite {
555561
return db;
556562
}
557563
// std::optional support for NULL values
558-
#if __has_include(<optional>)
564+
#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
559565
template <typename OptionalT> inline database_binder& operator <<(database_binder& db, const std::optional<OptionalT>& val) {
560566
if(val) {
561567
return operator << (std::move(db), std::move(*val));

0 commit comments

Comments
 (0)