Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 :
10 : #ifndef INCLUDED_O3TL_MAKE_UNIQUE_HXX
11 : #define INCLUDED_O3TL_MAKE_UNIQUE_HXX
12 :
13 : #include <memory>
14 : #include <utility>
15 :
16 : namespace o3tl
17 : {
18 :
19 : /**
20 : * Constructs an object of type T and wraps it in a std::unique_ptr.
21 : *
22 : * Can be replaced by std::make_unique when we allow C++14.
23 : */
24 : template<typename T, typename... Args>
25 9266 : typename std::unique_ptr<T> make_unique(Args&& ... args)
26 : {
27 9266 : return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
28 : }
29 :
30 : }
31 :
32 : #endif
33 :
34 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|