Skip to content

Commit 2e96ba7

Browse files
authored
Merge branch 'master' into variant
2 parents 0c49bf5 + 558f5fa commit 2e96ba7

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -280,20 +280,18 @@ int main() {
280280
}
281281
```
282282

283-
NULL values (DEPRICATED)
283+
NULL values (C++17)
284284
----
285-
**Note: this option is deprecated and will be removed in future versions.**
286-
You can enable boost support by defining _MODERN_SQLITE_BOOST_OPTIONAL_SUPPORT before importing sqlite_modern_cpp header.
285+
You can use `std::optional<T>` as an alternative for `std::unique_ptr<T>` to work with NULL values.
287286

288287
```c++
289-
#define _MODERN_SQLITE_BOOST_OPTIONAL_SUPPORT
290288
#include <sqlite_modern_cpp.h>
291289

292290
struct User {
293291
long long _id;
294-
boost::optional<int> age;
295-
boost::optional<string> name;
296-
boost::optional<real> weight;
292+
std::optional<int> age;
293+
std::optional<string> name;
294+
std::optional<real> weight;
297295
};
298296

299297
{
@@ -317,9 +315,9 @@ You can enable boost support by defining _MODERN_SQLITE_BOOST_OPTIONAL_SUPPORT b
317315
db << "select _id,age,name,weight from user where age > ? ;"
318316
<< 18
319317
>> [&](long long id,
320-
boost::optional<int> age,
321-
boost::optional<string> name
322-
boost::optional<real> weight) {
318+
std::optional<int> age,
319+
std::optional<string> name
320+
std::optional<real> weight) {
323321

324322
User user;
325323
user._id = id;
@@ -336,6 +334,10 @@ You can enable boost support by defining _MODERN_SQLITE_BOOST_OPTIONAL_SUPPORT b
336334
}
337335
```
338336
337+
If you do not have C++17 support, you can use boost optional instead by defining `_MODERN_SQLITE_BOOST_OPTIONAL_SUPPORT` before importing the `sqlite_modern_cpp` header.
338+
339+
**Note: boost support is deprecated and will be removed in future versions.**
340+
339341
Variant type support (C++17)
340342
----
341343
If your columns may have flexible types, you can use C++17's `std::variant` to extract the value.

0 commit comments

Comments
 (0)