aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/deps/rpclib/include/rpc/detail/make_unique.h
blob: 1297aeaab12f0ededf99aef35a9a722e674cfb14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#pragma once

#ifndef MAKE_UNIQUE_H_FOOBAR
#define MAKE_UNIQUE_H_FOOBAR

#include <memory>

namespace rpc {
namespace detail {

// Default behaviour is to assume C++11, overriding RPCLIB_CXX_STANDARD can use
// newer standards:
#if RPCLIB_CXX_STANDARD >= 14

using std::make_unique;

#else

template<typename T, typename... Ts>
std::unique_ptr<T> make_unique(Ts&&... params)
{
    return std::unique_ptr<T>(new T(std::forward<Ts>(params)...));
}

#endif

} /* detail */
} /* rpc  */

#endif /* end of include guard: MAKE_UNIQUE_H_FOOBAR */