Bitcoin Core  0.19.99
P2P Digital Currency
optional.h
Go to the documentation of this file.
1 // Copyright (c) 2017-2019 The Bitcoin Core developers
2 // Distributed under the MIT software license, see the accompanying
3 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 
5 #ifndef BITCOIN_OPTIONAL_H
6 #define BITCOIN_OPTIONAL_H
7 
8 #include <utility>
9 
10 #include <boost/optional.hpp>
11 
13 template <typename T>
14 using Optional = boost::optional<T>;
15 
17 template <typename T>
18 Optional<T> MakeOptional(bool condition, T&& value)
19 {
20  return boost::make_optional(condition, std::forward<T>(value));
21 }
22 
24 static auto& nullopt = boost::none;
25 
26 #endif // BITCOIN_OPTIONAL_H
Optional< T > MakeOptional(bool condition, T &&value)
Substitute for C++17 std::make_optional.
Definition: optional.h:18
static auto & nullopt
Substitute for C++17 std::nullopt.
Definition: optional.h:24
boost::optional< T > Optional
Substitute for C++17 std::optional.
Definition: optional.h:14