Skip to content

Commit

Permalink
Merge pull request #90 from zauguin/master
Browse files Browse the repository at this point in the history
Fix build for modern standard libraries
  • Loading branch information
aminroosta committed Feb 17, 2017
2 parents ed6b2a0 + a578ca6 commit a2acd4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions hdr/sqlite_modern_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
#include <vector>

#ifdef __has_include
#if __has_include(<optional>)
#define _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#if __cplusplus > 201402 && __has_include(<optional>)
#define MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#endif
#endif

#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#ifdef MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#include <optional>
#endif

Expand Down Expand Up @@ -276,7 +276,7 @@ namespace sqlite {
friend database_binder& operator <<(database_binder& db, const std::u16string& txt);


#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#ifdef MODERN_SQLITE_STD_OPTIONAL_SUPPORT
template <typename OptionalT> friend database_binder& operator <<(database_binder& db, const std::optional<OptionalT>& val);
template <typename OptionalT> friend void get_col_from_db(database_binder& db, int inx, std::optional<OptionalT>& o);
#endif
Expand Down Expand Up @@ -791,7 +791,7 @@ namespace sqlite {
sqlite3_result_text16(db, val.data(), -1, SQLITE_TRANSIENT);
}
// std::optional support for NULL values
#ifdef _MODERN_SQLITE_STD_OPTIONAL_SUPPORT
#ifdef MODERN_SQLITE_STD_OPTIONAL_SUPPORT
template <typename OptionalT> inline database_binder& operator <<(database_binder& db, const std::optional<OptionalT>& val) {
if(val) {
return operator << (std::move(db), std::move(*val));
Expand Down
2 changes: 1 addition & 1 deletion tests/std_optional.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using namespace sqlite;
using namespace std;

#if __has_include(<optional>)
#ifdef MODERN_SQLITE_STD_OPTIONAL_SUPPORT
void insert(database& db, bool is_null) {
int id = 1;
std::optional<int> val;
Expand Down

0 comments on commit a2acd4a

Please sign in to comment.