FMath: MIX_FLOATS_3_ARGS
#include "Templates/ResolveTypeAmbiguity.h"
Access: public
Description
Preprocessor macro that injects a template overload for a three-argument function, allowing mixed float/double/integral argument lists by promoting all arguments to the highest-precision floating-point type among them.
Caveats & Gotchas
- • This is a code-generation macro, not a callable function. It emits a template at the call site in the class body. You can see its expansion in FMath at usages like MIX_FLOATS_3_ARGS(Clamp).
- • The injected overload only fires when the argument types are not all identical. Calling e.g. Clamp(1.0f, 2.0f, 3.0f) still resolves to the original float overload; this macro handles the Clamp(float, double, int) style calls.
Signature
MIX_FLOATS_3_ARGS(Func) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Func | identifier | The name of the existing three-argument template function to generate mixed-type overloads for. | — |
Example
Using the mixed-type Clamp it enables C++
// Enabled by MIX_FLOATS_3_ARGS(Clamp) inside FMath:
double Result = FMath::Clamp(1, 0.0, 5.0); // int + double + double -> double
float Result2 = FMath::Clamp(1.5f, 0, 10); // float + int + int -> float Tags
Version History
Introduced in: 5.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?