File indexing completed on 2024-05-19 05:32:28

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <memory>
0012 
0013 namespace KWin
0014 {
0015 
0016 struct CDeleter
0017 {
0018     template<typename T>
0019     void operator()(T *ptr)
0020     {
0021         if (ptr) {
0022             free(ptr);
0023         }
0024     }
0025 };
0026 
0027 template<typename T>
0028 using UniqueCPtr = std::unique_ptr<T, CDeleter>;
0029 
0030 }