qxLib
Public Member Functions | List of all members
qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue > Class Template Reference

Lightweight assertion comparison object that preserves compared operand values for diagnostics. More...

#include <assert_compare.h>

Public Member Functions

constexpr assert_comparison (left_t &&left, right_t &&right) noexcept(std::is_nothrow_constructible_v< left_t, left_t && > &&std::is_nothrow_constructible_v< right_t, right_t && >)
 Construct comparison object from two operands. More...
 
constexpr bool result () const noexcept(noexcept(operation_t {}(left(), right())))
 Evaluate comparison. More...
 
constexpr operator bool () const noexcept(noexcept(result()))
 Convert comparison object to bool. More...
 
constexpr const auto & left () const noexcept
 Get left operand. More...
 
constexpr const auto & right () const noexcept
 Get right operand. More...
 

Detailed Description

template<class left_t, class right_t, class operation_t, bool bLeftIsLvalue, bool bRightIsLvalue>
class qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >

Lightweight assertion comparison object that preserves compared operand values for diagnostics.

Template Parameters
left_t- left operand type
right_t- right operand type
operation_t- operation type, must be a specialization of std binary function (e.g. std::equal_to<>, std::less<>, etc.)
bLeftIsLvalue- whether the left operand was passed as an lvalue
bRightIsLvalue- whether the right operand was passed as an lvalue
Author
Khrapov
Date
19.05.2026

Definition at line 40 of file assert_compare.h.

Constructor & Destructor Documentation

◆ assert_comparison()

template<class left_t , class right_t , class operation_t , bool bLeftIsLvalue, bool bRightIsLvalue>
constexpr qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >::assert_comparison ( left_t &&  left,
right_t &&  right 
)
constexprnoexcept

Construct comparison object from two operands.

Parameters
left- left operand
right- right operand

Definition at line 434 of file assert_compare.inl.

Member Function Documentation

◆ left()

template<class left_t , class right_t , class operation_t , bool bLeftIsLvalue, bool bRightIsLvalue>
constexpr const auto & qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >::left
constexprnoexcept

Get left operand.

Return values
-left operand

Definition at line 457 of file assert_compare.inl.

◆ operator bool()

template<class left_t , class right_t , class operation_t , bool bLeftIsLvalue, bool bRightIsLvalue>
constexpr qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >::operator bool
explicitconstexprnoexcept

Convert comparison object to bool.

Return values
-comparison result

Definition at line 450 of file assert_compare.inl.

◆ result()

template<class left_t , class right_t , class operation_t , bool bLeftIsLvalue, bool bRightIsLvalue>
constexpr bool qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >::result
constexprnoexcept

Evaluate comparison.

Return values
-comparison result

Definition at line 443 of file assert_compare.inl.

◆ right()

template<class left_t , class right_t , class operation_t , bool bLeftIsLvalue, bool bRightIsLvalue>
constexpr const auto & qx::details::assert_comparison< left_t, right_t, operation_t, bLeftIsLvalue, bRightIsLvalue >::right
constexprnoexcept

Get right operand.

Return values
-right operand

Definition at line 464 of file assert_compare.inl.


The documentation for this class was generated from the following files: