ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
No Matches
FEquals Struct Reference


This function compares two boxes.

A default implementation is registered that compares the types (Box::IsSameType ) and if equal, with arrays compares the array's length, nulled state and finally the contents using memcmp.
For non-array types, it compares the relevant bytes in the placeholder. The number of leading relevant bytes is available with method Box::GetPlaceholderUsageLength .

Type-specific implementations are given and registered for fundamental types. Integrals of different sizes and floating point values will be compared by using Box::UnboxSignedIntegral , Box::UnboxUnsignedIntegral and Box::UnboxFloatingPoint and appropriate casting. In the case of floating point comparison, an epsilon distance is duly taken into account.

For custom types, with ComparableTypes, a templated implementation is suggested: Rather than implementing a specific box-function, the custom type should implement operator== and register an instantiation of the templated function.

See also
Method Box::operator== , which calls this function.

Definition at line 124 of file functions.inl.

Public Type Index:

using Signature = bool (*) ( const Box& self, const Box& rhs)

Public Static Method Index:

template<typename TComparable >
static bool ComparableTypes (const Box &self, const Box &rhs)

Type Definition Details:

◆ Signature

using Signature = bool (*) ( const Box& self, const Box& rhs)

Signature of the invokable function.

selfThe box that the function was invoked on.
rhsThe box to compare.
Return value and type is implementation specific.

Definition at line 133 of file functions.inl.

Method Details:

◆ ComparableTypes()

template<typename TComparable >
static bool ComparableTypes ( const Box & self,
const Box & rhs )

Templated implementation of the function signature, usable with boxable types which have operator== implemented.

This method interally is provide twice, once for types boxed as pointers and one for types boxed as values, and selected using TMP.
If a type is boxed as pointer, then TComparable has to be given as such pointer type. For comparison, the unboxed pointers will be dereferenced. If one is nulled, false is returned, if both are nulled, true.
See also
Template Parameters
TComparableThe mapped type that can be compared using operator==.
selfThe box that the function was invoked on.
rhsThe boxed value to compare.
true if self equals rhs , false otherwise.

The documentation for this struct was generated from the following file: