hyperledger/iroha
Iroha - A simple, decentralized ledger http://iroha.tech
range_tools.hpp
Go to the documentation of this file.
1 
6 #ifndef RANGE_TOOLS_HPP
7 #define RANGE_TOOLS_HPP
8 
9 #include <boost/range/adaptor/filtered.hpp>
10 #include <boost/range/adaptor/transformed.hpp>
11 
12 namespace iroha {
13 
14  template <typename T>
15  auto dereferenceOptionals(T range) {
16  return range | boost::adaptors::filtered([](const auto &t) {
17  return static_cast<bool>(t);
18  })
19  | boost::adaptors::transformed([](auto t) { return *t; });
20  }
21 
22 } // namespace iroha
23 
24 #endif
Definition: block_query.hpp:15
auto dereferenceOptionals(T range)
Definition: range_tools.hpp:15