Qx v0.5.7
Qt Extensions Library
Loading...
Searching...
No Matches
qx-helpers.h File Reference

The qx-concepts header file provides a set of various convenience functions that are are designed to facilitate common fundamental tasks with as brief syntax as possible. More...

#include <type_traits>
Include dependency graph for qx-helpers.h:

Go to the source code of this file.

Functions

template<typename T >
const T qxAsConst (T &&t)
 
template<typename T >
std::add_const< T >::type qxAsConst (T &t)
 
template<typename T >
void qxDelete (T *&pointer)
 

Function Documentation

◆ qxAsConst() [1/2]

template<typename T >
const T qxAsConst ( T && t)

Serves the same purpose as qAsConst() (preventing implicitly-shared Qt containers from detaching), but this version works for rvalues, albeit with some efficiency concerns depending on the nature of t.

◆ qxAsConst() [2/2]

template<typename T >
std::add_const< T >::type qxAsConst ( T & t)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Equivalent to qAsConst(T& t).

This overload exists so that qxAsConst can consistently be used everywhere for both lvalues and rvalues, instead of having to employ mixed usage of qxAsConst() and qAsConst().

◆ qxDelete()

template<typename T >
void qxDelete ( T *& pointer)

Calls delete on pointer and then sets it to nullptr .