File indexing completed on 2024-04-28 04:57:42

0001 /*
0002  *   SPDX-FileCopyrightText: 2012-2016 Ivan Cukic <ivan.cukic@kde.org>
0003  *
0004  *   SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #ifndef D_PTR_IMPLEMENTATION_H
0008 #define D_PTR_IMPLEMENTATION_H
0009 
0010 #include <utility>
0011 
0012 namespace kamd
0013 {
0014 namespace utils
0015 {
0016 
0017 template<typename T>
0018 d_ptr<T>::d_ptr()
0019     : d(new T())
0020 {
0021 }
0022 
0023 template<typename T>
0024 template<typename... Args>
0025 d_ptr<T>::d_ptr(Args &&...args)
0026     : d(new T(std::forward<Args>(args)...))
0027 {
0028 }
0029 
0030 template<typename T>
0031 d_ptr<T>::~d_ptr()
0032 {
0033 }
0034 
0035 template<typename T>
0036 T *d_ptr<T>::operator->() const
0037 {
0038     return d.get();
0039 }
0040 
0041 } // namespace utils
0042 } // namespace kamd
0043 
0044 #endif