Qx v0.5.8
Qt Extensions Library
Loading...
Searching...
No Matches
qx-helpers.h
Go to the documentation of this file.
1#ifndef QX_HELPERS_H
2#define QX_HELPERS_H
3
4// Standard Library Includes
5#include <type_traits>
6
7//Non-namespace Structs----------------------------------------------------------
8/* TODO: Figure out how to constrain this to only accept functors, issue is at least as of C++20
9 * there doesnt seem to be a way to check if a type has an arbitrary number of operator() overloads
10 * with an arbitrary number of arguments.
11 */
12template<typename... Functors>
13struct qxFuncAggregate : Functors... {
14 using Functors::operator()...;
15};
16
17//Non-namespace Functions----------------------------------------------------------
18template <typename T>
19const T qxAsConst(T&& t) { return std::move(t); }
20
21template <typename T>
22typename std::add_const<T>::type qxAsConst(T& t) { return qAsConst(t); }
23
24template <typename T>
25void qxDelete(T*& pointer)
26{
27 delete pointer;
28 pointer = nullptr;
29}
30
31#endif // QX_HELPERS_H
void qxDelete(T *&pointer)
Definition qx-helpers.h:25
const T qxAsConst(T &&t)
Definition qx-helpers.h:19
Definition qx-helpers.h:13