hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
bind.hpp
Go to the documentation of this file.
1 
6 #ifndef IROHA_COMMON_BIND_HPP
7 #define IROHA_COMMON_BIND_HPP
8 
9 #include <ciso646>
10 #include <type_traits>
11 #include <utility>
12 
13 namespace iroha {
14 
41  template <typename T, typename Transform>
42  auto operator|(T &&t, Transform &&f) -> std::enable_if_t<
43  not std::is_same<
44  decltype(std::forward<Transform>(f)(*std::forward<T>(t))),
45  void>::value,
46  decltype(std::forward<Transform>(f)(*std::forward<T>(t)))> {
47  if (std::forward<T>(t)) {
48  return std::forward<Transform>(f)(*std::forward<T>(t));
49  }
50  return {};
51  }
52 
77  template <typename T, typename Transform>
78  auto operator|(T &&t, Transform &&f) -> std::enable_if_t<
79  std::is_same<decltype(std::forward<Transform>(f)(*std::forward<T>(t))),
80  void>::value> {
81  if (std::forward<T>(t)) {
82  std::forward<Transform>(f)(*std::forward<T>(t));
83  }
84  }
85 } // namespace iroha
86 
87 #endif // IROHA_COMMON_BIND_HPP
auto operator|(T &&t, Transform &&f) -> std::enable_if_t< not std::is_same< decltype(std::forward< Transform >(f)(*std::forward< T >(t))), void >::value, decltype(std::forward< Transform >(f)(*std::forward< T >(t)))>
Definition: bind.hpp:42
Definition: block_query.hpp:16