|
63 | 63 | #include <iostream> // for std::{cout, cerr}
|
64 | 64 | #include <string> // for std::string<>
|
65 | 65 | #include <vector> // for std::vector<>
|
| 66 | +#include <optional> // for std::optional<> |
66 | 67 |
|
67 | 68 | #include <fmt/format.h> // for fmt::format
|
68 | 69 | #include <CLI/CLI.hpp> // for CLI::App
|
69 |
| -#include <boost/optional.hpp> // for boost::optional<> |
70 | 70 |
|
71 | 71 | #include <fable/confable.hpp> // for fable::{Confable, CONFABLE_SCHEMA}
|
72 | 72 | #include <fable/schema.hpp> // for fable::{Schema, String}
|
73 |
| -#include <fable/schema/boost_optional.hpp> // for fable::{Optional, make_schema} |
74 | 73 | #include <fable/utility.hpp> // for fable::{read_conf}
|
75 | 74 |
|
76 | 75 | // All structs that are used directly with fable for serialization and
|
@@ -170,16 +169,16 @@ struct Contact : public fable::Confable {
|
170 | 169 | std::string firstName;
|
171 | 170 | std::string lastName;
|
172 | 171 | bool isAlive{false};
|
173 |
| - boost::optional<uint8_t> age{0}; |
| 172 | + std::optional<uint8_t> age{0}; |
174 | 173 |
|
175 |
| - boost::optional<Address> address; |
| 174 | + std::optional<Address> address; |
176 | 175 | std::vector<PhoneNumber> phoneNumbers;
|
177 | 176 | std::vector<std::string> children;
|
178 |
| - boost::optional<std::string> spouse; |
| 177 | + std::optional<std::string> spouse; |
179 | 178 |
|
180 | 179 | Contact() = default;
|
181 | 180 | Contact(
|
182 |
| - std::string first, std::string last, bool alive, boost::optional<uint8_t> age) noexcept |
| 181 | + std::string first, std::string last, bool alive, std::optional<uint8_t> age) noexcept |
183 | 182 | : firstName(std::move(first)), lastName(std::move(last)), isAlive(alive), age(age) {}
|
184 | 183 |
|
185 | 184 | Contact with_address(Address&& addr) && {
|
@@ -222,7 +221,7 @@ int main(int argc, char** argv) {
|
222 | 221 | Contact("John", "Smith", true, 42)
|
223 | 222 | .with_address({"Generate Road 12", "Nowhere", "NA", "00000"})
|
224 | 223 | .with_phone({PhoneType::Home, "+1 650 0000 000"}),
|
225 |
| - Contact("Jane", "Doe", false, boost::none), |
| 224 | + Contact("Jane", "Doe", false, std::nullopt), |
226 | 225 | };
|
227 | 226 |
|
228 | 227 | // If we don't have a Confable, we can create a Schema on the fly and pass
|
|
0 commit comments