RealDocs

FMath: MIX_FLOATS_2_ARGS

function Core Since 5.0
#include "Templates/ResolveTypeAmbiguity.h"
Access: public

Description

Preprocessor macro that injects a two-argument template overload for mixing float/double/integral argument types, promoting all arguments to the highest-precision floating-point type.

Caveats & Gotchas

  • Like MIX_FLOATS_3_ARGS, this is a code-generation macro, not a real function. It only fires when at least one argument is a floating-point type and the two arguments are not the same type.
  • Be aware that integer-only calls to functions decorated with this macro are not covered by the mixed overload — e.g. GridSnap(int32, int32) resolves to the existing template, not a float conversion.

Signature

MIX_FLOATS_2_ARGS(Func)

Parameters

Name Type Description Default
Func identifier The name of the existing two-argument template function to generate mixed-type overloads for.

Example

Using the mixed-type GridSnap it enables C++
// Enabled by MIX_FLOATS_2_ARGS(GridSnap) inside FMath:
double Snapped = FMath::GridSnap(3.7, 1.0f);  // double + float -> double

Tags

Version History

Introduced in: 5.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.