hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
optional_reference_equal.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_OPTIONAL_REFERENCE_EQUAL_HPP
7 #define IROHA_OPTIONAL_REFERENCE_EQUAL_HPP
8 
9 #include <functional>
10 #include <optional>
11 
12 namespace iroha {
13 
18  template <typename T>
19  constexpr bool optionalReferenceEqual(
20  const std::optional<std::reference_wrapper<T>> &lhs,
21  const std::optional<std::reference_wrapper<T>> &rhs) {
22  return static_cast<bool>(lhs) == static_cast<bool>(rhs)
23  and (not lhs or lhs->get() == rhs->get());
24  }
25 } // namespace iroha
26 
27 #endif // IROHA_OPTIONAL_REFERENCE_EQUAL_HPP
constexpr bool optionalReferenceEqual(const std::optional< std::reference_wrapper< T >> &lhs, const std::optional< std::reference_wrapper< T >> &rhs)
Definition: optional_reference_equal.hpp:19
Definition: block_query.hpp:15