File: d_ptr_implementation.h

package info (click to toggle)
kio-extras 4%3A22.12.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 10,768 kB
  • sloc: cpp: 26,898; ansic: 4,443; perl: 1,058; xml: 97; sh: 69; python: 28; makefile: 9
file content (42 lines) | stat: -rw-r--r-- 659 bytes parent folder | download
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
32
33
34
35
36
37
38
39
40
41
42
/*
 *   SPDX-FileCopyrightText: 2012-2016 Ivan Cukic <ivan.cukic@kde.org>
 *
 *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
 */

#ifndef D_PTR_IMPLEMENTATION_H
#define D_PTR_IMPLEMENTATION_H

#include <utility>

namespace kamd {
namespace utils {

template <typename T>
d_ptr<T>::d_ptr()
    : d(new T())
{
}

template <typename T>
template <typename... Args>
d_ptr<T>::d_ptr(Args &&... args)
    : d(new T(std::forward<Args>(args)...))
{
}

template <typename T>
d_ptr<T>::~d_ptr()
{
}

template <typename T>
T *d_ptr<T>::operator->() const
{
    return d.get();
}

} // namespace utils
} // namespace kamd

#endif