LCOV - code coverage report
Current view: top level - src - optional.h (source / functions) Hit Total Coverage
Test: total_coverage.info Lines: 2 2 100.0 %
Date: 2020-09-26 01:30:44 Functions: 2 2 100.0 %

          Line data    Source code
       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             : 
      12             : //! Substitute for C++17 std::optional
      13             : template <typename T>
      14             : using Optional = boost::optional<T>;
      15             : 
      16             : //! Substitute for C++17 std::make_optional
      17             : template <typename T>
      18         107 : Optional<T> MakeOptional(bool condition, T&& value)
      19             : {
      20         107 :     return boost::make_optional(condition, std::forward<T>(value));
      21             : }
      22             : 
      23             : //! Substitute for C++17 std::nullopt
      24             : static auto& nullopt = boost::none;
      25             : 
      26             : #endif // BITCOIN_OPTIONAL_H

Generated by: LCOV version 1.15