qxLib
Macros
common.h File Reference
#include <qx/containers/string/string_setup.h>
#include <qx/meta/qualifiers.h>
#include <qx/macros/common.inl>

Go to the source code of this file.

Macros

#define QX_EMPTY_MACRO   static_assert(true)
 Placeholder for disabled macros. More...
 
#define QX_LINE   int(_QX_JOIN(__LINE__, U))
 Same as LINE, but fixes some problems when using it in constexpr context.
 
#define QX_SHORT_FILE   qx::details::last_slash(QX_TEXT(__FILE__))
 Cuts full absolute path to the file name only ex: "C:\folder1\foler2\file.h" => "file.h".
 
#define QX_SINGLE_ARGUMENT(...)   __VA_ARGS__
 Let macro param containing commas work fine "#define FOO(type, name) type name" FOO(QX_SINGLE_ARGUMENT(std::map<int, int>), map_var);. More...
 
#define QX_CONST_CAST_THIS()   const_cast<qx::switch_const_t<std::remove_pointer_t<decltype(this)>>*>(this)
 This macro is made for situations where you have a const method and you need exactly the same method but non-const. More...
 
#define QX_CALL_BEFORE_MAIN   inline volatile qx::details::call_before_main_invoker QX_LINE_NAME(_stubCallBeforeMain)
 Calls this lambda before the main invocation. More...
 
#define QX_DISABLE_OPTIMIZATIONS()   _QX_DISABLE_OPTIMIZATIONS()
 Start a block with compiling optimisations disabled. Must be outside of functions and have an appropriate QX_ENABLE_OPTIMIZATIONS().
 
#define QX_ENABLE_OPTIMIZATIONS()   _QX_ENABLE_OPTIMIZATIONS()
 End a block with compiling optimisations disabled.
 
#define QX_FORCE_INLINE   _QX_FORCE_INLINE
 Make this function forcefully inlined (except for QX_DEBUG build)
 

Detailed Description

Author
Khrapov
Date
17.06.2019

Definition in file common.h.

Macro Definition Documentation

◆ QX_CALL_BEFORE_MAIN

#define QX_CALL_BEFORE_MAIN   inline volatile qx::details::call_before_main_invoker QX_LINE_NAME(_stubCallBeforeMain)

Calls this lambda before the main invocation.

Note
This function must be in an object file, that is actually linked to your exe
{
};
#define QX_CALL_BEFORE_MAIN
Calls this lambda before the main invocation.
Definition: common.h:74

Definition at line 74 of file common.h.

◆ QX_CONST_CAST_THIS

#define QX_CONST_CAST_THIS ( )    const_cast<qx::switch_const_t<std::remove_pointer_t<decltype(this)>>*>(this)

This macro is made for situations where you have a const method and you need exactly the same method but non-const.

Warning
You can also use it in vice-versa situations, but be careful as it will break your const guarantees
int foo() const
{
// some complicated stuff
}
int foo()
{
}
#define QX_CONST_CAST_THIS()
This macro is made for situations where you have a const method and you need exactly the same method ...
Definition: common.h:61

Definition at line 61 of file common.h.

◆ QX_EMPTY_MACRO

#define QX_EMPTY_MACRO   static_assert(true)

Placeholder for disabled macros.

Has no effect and work correctly with "if else" You can use it in the end of a macro to enforce user to add ; after it

Definition at line 22 of file common.h.

◆ QX_SINGLE_ARGUMENT

#define QX_SINGLE_ARGUMENT (   ...)    __VA_ARGS__

Let macro param containing commas work fine "#define FOO(type, name) type name" FOO(QX_SINGLE_ARGUMENT(std::map<int, int>), map_var);.

Parameters
...- param containing commas

Definition at line 43 of file common.h.