File indexing completed on 2024-05-12 16:59:21

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 template<typename T>
0017 d_ptr<T>::d_ptr()
0018     : d(new T())
0019 {
0020 }
0021 
0022 template<typename T>
0023 template<typename... Args>
0024 d_ptr<T>::d_ptr(Args &&...args)
0025     : d(new T(std::forward<Args>(args)...))
0026 {
0027 }
0028 
0029 template<typename T>
0030 d_ptr<T>::~d_ptr()
0031 {
0032 }
0033 
0034 template<typename T>
0035 T *d_ptr<T>::operator->() const
0036 {
0037     return d.get();
0038 }
0039 
0040 } // namespace utils
0041 } // namespace kamd
0042 
0043 #endif