Line data Source code
1 : /**
2 : * Copyright Soramitsu Co., Ltd. All Rights Reserved.
3 : * SPDX-License-Identifier: Apache-2.0
4 : */
5 :
6 : #ifndef IROHA_COMMON_HPP
7 : #define IROHA_COMMON_HPP
8 :
9 : #include <memory>
10 : #include <boost/optional.hpp>
11 :
12 : namespace iroha {
13 : namespace model {
14 : // Optional over shared pointer
15 : template <typename T>
16 : using optional_ptr = boost::optional<std::shared_ptr<T>>;
17 :
18 : template <typename T, typename... Args>
19 : optional_ptr<T> make_optional_ptr(Args &&... args) {
20 8 : return std::make_shared<T>(std::forward<Args>(args)...);
21 0 : }
22 : } // namespace model
23 : } // namespace iroha
24 :
25 : #endif // IROHA_COMMON_HPP
|