sincerely Singaporean

If you have not done so, read this full tutorial on how to use SGEXTN to build an application.

SGLLesserThan

see header file

(no source file, everything inside header)

template ‹typename T› class SGLLesserThan;

part of SGEXTN module SG_Containers

ascending comparator struct for use with SGEXTN Containers

detailed description

list of all including inherited members

implementation details

preprocessor file inclusion directive: #include ‹SGLLesserThan.h›

CMake target for BuildLah: SGEXTN::SG_Containers

see this link for more information about BuildLah

parent class: (none)

children classes: (none)

instance member functions

[[nodiscard]] bool operator()(const T& a, const T& b) const;

Detailed Description

SGLLesserThan provides an ascending comparator struct for use with SGEXTN Containers, this should be used most of the time when using SGLPriorityQueue, SGLSet, SGLMultiSet, or SGLMap. You need operator‹ defined to use SGLLesserThan with custom structs. SGLLesserThan works with any object pointers. This is a template based class with no separate source file.

Implementation Details

SGLLesserThan calls operator‹ on the corresponding data type if it is a custom struct. For object pointers, direct comparison is undefined behaviour if they are not allocated in the same C array creation call, so SGLLesserThan converts them to bytes first and compares the bytes.

[[nodiscard]] bool operator()(const T& a, const T& b) const;

Returns if a is lesser than b.

"lesser than" is Singlish. SGEXTN API names can use any word understood by most people in Singapore, so Singlish also can one.

This is internally used by SGLPriorityQueue, SGLSet, SGLMultiSet, and SGLMap when SGLLesserThan is selected as the comparator struct.

The presense of operator() makes SGLLesserThan a functor.

This will not compile if operator‹ is not defined for T. Check the source code of any SGEXTN struct (SGXChar, SGXString, SGXColourRGBA, SGXColourHSLA, SGXIdentifier, SGXTimeStamp, SGXVector2) to see how to define operator‹.

©2025 05524F.sg (Singapore)

contact 05524F / report a bug / make a suggestion

about 05524F SINGAPORE values

list of 05524F projects