Remove 'boost::optional'-related gcc warnings

This commit is contained in:
Hennadii Stepanov
2019-01-30 13:28:41 +02:00
parent 72ca72e637
commit 2d483142a7
3 changed files with 13 additions and 2 deletions

View File

@@ -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;