Skip to content

Commit 18f2b5b

Browse files
committed
Correctly observe availability of std::any
`std::any` is only available starting with a C++17 library.
1 parent 1a52a5c commit 18f2b5b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

examples/any.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@
1414
* BLOB is mapped to std::vector<char>.
1515
*/
1616
#include <sqlite_orm/sqlite_orm.h>
17+
#ifdef __has_include
18+
#if __has_include(<any>)
1719
#include <any>
20+
#endif
21+
#endif
22+
23+
#if __cpp_lib_any >= 201606L
24+
#define ENABLE_THIS_EXAMPLE
25+
#endif
26+
27+
#ifdef ENABLE_THIS_EXAMPLE
1828
#include <iostream>
1929
#include <cstdio>
2030

@@ -128,8 +138,10 @@ namespace sqlite_orm {
128138
}
129139
};
130140
}
141+
#endif
131142

132143
int main() {
144+
#ifdef ENABLE_THIS_EXAMPLE
133145
struct Value {
134146
int id = 0;
135147
std::any value;
@@ -151,5 +163,6 @@ int main() {
151163
cout << storage.dump(test) << endl;
152164
}
153165
cout << endl;
166+
#endif
154167
return 0;
155168
}

0 commit comments

Comments
 (0)