![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include "CoreTypes.h"#include "Templates/IsFloatingPoint.h"#include "Templates/UnrealTypeTraits.h"#include "Templates/IsSigned.h"#include "Templates/IsIntegral.h"#include "Templates/Requires.h"Go to the source code of this file.
| #define MIX_FLOATS_2_ARGS | ( | Func | ) |
| #define MIX_FLOATS_3_ARGS | ( | Func | ) |
| #define MIX_FLOATS_TO_TYPE_2_ARGS | ( | Func, | |
| ReturnType | |||
| ) |
| #define MIX_FLOATS_TO_TYPE_3_ARGS | ( | Func, | |
| ReturnType | |||
| ) |
| #define MIX_SIGNED_INTS_2_ARGS | ( | Func | ) | MIX_SIGNED_INTS_2_ARGS_ACTUAL(Func,) |
| #define MIX_SIGNED_INTS_2_ARGS_ACTUAL | ( | Func, | |
| OptionalMarkup | |||
| ) |
This file defines a few macros which can be used to restrict (via deprecation) ambiguous calls to functions expecting float params/return type. This also handles mixing of argument types where at least one argument is a float/double and the rest can be promoted to the highest-precision type to infer the expected type of the return value, or where non-float arguments are mixed in a function where the result should be the result of mixed arithmetic between the types.
For example:
template< class T > static T MyFunc(const T X, const T Y) { return X < Y ? X : Y; } // Allows mixing of types without causing type ambiguity MIX_TYPES_2_ARGS(MyFunc);
static float Sin( float Value ) { return sinf(Value); } static double Sin( double Value ) { return sin(Value); }
static float Fmod(float X, float Y); static double Fmod(double X, double Y); // Disallows Fmod(int32, int32) because one argument must be a floating point type. // Promotes calls such as "Fmod(float, double)" or "Fmod(double, int)" to "double Fmod(double, double)" because double has the highest precision of the argument types. RESOLVE_FLOAT_AMBIGUITY_2_ARGS(Fmod);
| #define MIX_SIGNED_INTS_2_ARGS_CONSTEXPR | ( | Func | ) | MIX_SIGNED_INTS_2_ARGS_ACTUAL(Func, constexpr) |
| #define MIX_SIGNED_INTS_3_ARGS | ( | Func | ) | MIX_SIGNED_INTS_3_ARGS_ACTUAL(Func,) |
| #define MIX_SIGNED_INTS_3_ARGS_CONSTEXPR | ( | Func | ) | MIX_SIGNED_INTS_3_ARGS_ACTUAL(Func, constexpr) |
| #define MIX_SIGNED_TYPES_3_ARGS_ACTUAL | ( | Func, | |
| OptionalMarkup | |||
| ) |
| #define RESOLVE_FLOAT_AMBIGUITY_2_ARGS | ( | Func | ) | MIX_FLOATS_2_ARGS(Func); |
| #define RESOLVE_FLOAT_AMBIGUITY_3_ARGS | ( | Func | ) | MIX_FLOATS_3_ARGS(Func); |
| #define RESOLVE_FLOAT_PREDICATE_AMBIGUITY_2_ARGS | ( | Func | ) | RESOLVE_FLOAT_TO_TYPE_AMBIGUITY_2_ARGS(Func, bool) |
| #define RESOLVE_FLOAT_PREDICATE_AMBIGUITY_3_ARGS | ( | Func | ) | RESOLVE_FLOAT_TO_TYPE_AMBIGUITY_3_ARGS(Func, bool) |
| #define RESOLVE_FLOAT_TO_TYPE_AMBIGUITY_2_ARGS | ( | Func, | |
| ReturnType | |||
| ) | MIX_FLOATS_TO_TYPE_2_ARGS(Func, ReturnType); |
| #define RESOLVE_FLOAT_TO_TYPE_AMBIGUITY_3_ARGS | ( | Func, | |
| ReturnType | |||
| ) | MIX_FLOATS_TO_TYPE_3_ARGS(Func, ReturnType); |