diff options
| author | Hennadii Stepanov <[email protected]> | 2019-01-30 13:28:41 +0200 |
|---|---|---|
| committer | Hennadii Stepanov <[email protected]> | 2019-01-30 22:44:28 +0200 |
| commit | 2d483142a7051389afe74c57a216843e6306f1a8 (patch) | |
| tree | accfe091b5d48697633acfb009a718d3939657d2 /src/optional.h | |
| parent | Merge #14711: Remove uses of chainActive and mapBlockIndex in wallet code (diff) | |
| download | discoin-2d483142a7051389afe74c57a216843e6306f1a8.tar.xz discoin-2d483142a7051389afe74c57a216843e6306f1a8.zip | |
Remove 'boost::optional'-related gcc warnings
Diffstat (limited to 'src/optional.h')
| -rw-r--r-- | src/optional.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/optional.h b/src/optional.h index 1614c8971..95a3b24d0 100644 --- a/src/optional.h +++ b/src/optional.h @@ -5,12 +5,21 @@ #ifndef BITCOIN_OPTIONAL_H #define BITCOIN_OPTIONAL_H +#include <utility> + #include <boost/optional.hpp> //! Substitute for C++17 std::optional template <typename T> using Optional = boost::optional<T>; +//! Substitute for C++17 std::make_optional +template <typename T> +Optional<T> MakeOptional(bool condition, T&& value) +{ + return boost::make_optional(condition, std::forward<T>(value)); +} + //! Substitute for C++17 std::nullopt static auto& nullopt = boost::none; |