Common macros and basic objects.
More...
#include <cstdint>
#include <utility>
Go to the source code of this file.
|
template<std::size_t N1, std::size_t N2, typename TVisitor > |
INLINE void | staticFor (TVisitor &&visitor) |
|
template<typename... TArgs> |
void | Detail::expandPack (TArgs &&...) |
|
template<typename TVisitor , typename... TArgs> |
INLINE void | staticForEach (TVisitor &&visitor, TArgs &&... args) |
|
template<std::size_t N, typename TValue , typename... TOthers> |
decltype(auto) INLINE | selectNth (TValue &&value, TOthers &&... others) |
|
Common macros and basic objects.
- Author
- Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz)
- Date
- 2016-2021
Definition in file Object.h.
◆ DEPRECATED
#define DEPRECATED __attribute__((deprecated)) |
◆ INL
#define INL __attribute__((always_inline)) |
◆ INLINE
#define INLINE __attribute__((always_inline)) inline |
Macros for conditional compilation based on selected compiler.
Force inline for gcc
Definition at line 31 of file Object.h.
◆ MARK_USED
#define MARK_USED |
( |
|
x | ) |
(void)sizeof(x) |
Silences the "unused variable" warning for given variable.
- Note
- sizeof is used to make sure x is not evaluated.
Definition at line 42 of file Object.h.
◆ NAMESPACE_SPH_BEGIN
#define NAMESPACE_SPH_BEGIN namespace Sph { |
◆ NAMESPACE_SPH_END
#define NAMESPACE_SPH_END } |
◆ NO_INLINE
#define NO_INLINE __attribute__((noinline)) |
◆ SPH_FALLTHROUGH
#define SPH_FALLTHROUGH [[fallthrough]]; |
◆ SPH_LIKELY
#define SPH_LIKELY |
( |
|
x | ) |
__builtin_expect(bool(x), 1) |
Branch prediction hints.
Definition at line 49 of file Object.h.
◆ SPH_UNLIKELY
#define SPH_UNLIKELY |
( |
|
x | ) |
__builtin_expect(bool(x), 0) |
◆ UNUSED
◆ selectNth()
template<std::size_t N, typename TValue , typename... TOthers>
decltype(auto) INLINE selectNth |
( |
TValue && |
value, |
|
|
TOthers &&... |
others |
|
) |
| |
Returns N-th argument from an argument list. The type of the returned argument matches the type of the input argument.
Definition at line 159 of file Object.h.
◆ staticFor()
template<std::size_t N1, std::size_t N2, typename TVisitor >
INLINE void staticFor |
( |
TVisitor && |
visitor | ) |
|
Static for loop from n1 to n2, including both values. Takes an object as an argument that must implement templated method template<int n> visit(); for loop will pass the current index as a template parameter, so that it can be used as a constant expression.
Definition at line 123 of file Object.h.
◆ staticForEach()
template<typename TVisitor , typename... TArgs>
INLINE void staticForEach |
( |
TVisitor && |
visitor, |
|
|
TArgs &&... |
args |
|
) |
| |