KDBindings API Documentation  1.0.95
Public Member Functions | List of all members
KDBindings::equal_to< T > Struct Template Reference

An instance of the KDBindings::equal_to struct is used to decide whether two values of type T are equal in the context of data binding. More...

#include <property.h>

Public Member Functions

auto operator() (const T &x, const T &y) const noexcept -> std::enable_if_t< Private::are_equality_comparable_v< T, T >, bool >
 
template<typename X , typename Y >
auto operator() (const X &, const Y &) const noexcept -> std::enable_if_t<!Private::are_equality_comparable_v< X, Y >, bool >
 

Detailed Description

template<typename T>
struct KDBindings::equal_to< T >

An instance of the KDBindings::equal_to struct is used to decide whether two values of type T are equal in the context of data binding.

If a new value is assigned to a Property and the existing value is equal_to the existing value, the Property will not emit the Property::valueChanged or Property::valueAboutToChange signals and not change the stored value.

By default, all classes T that are equality comparable using std::equal_to delegate to std::equal_to for equality comparison. All other instances are assumed to never be equal. Therefore, to change the equality behavior of a Property<T>, either:

Definition at line 78 of file property.h.

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
auto KDBindings::equal_to< T >::operator() ( const T &  x,
const T &  y 
) const -> std::enable_if_t<Private::are_equality_comparable_v<T, T>, bool>
inlinenoexcept

This implementation of operator()() is only enabled if std::equal_to can be used to compare values of type T. In this case, std::equal_to is used to decide whether values of type T are equal.

Returns
bool - Whether the values are equal.

Definition at line 86 of file property.h.

◆ operator()() [2/2]

template<typename T >
template<typename X , typename Y >
auto KDBindings::equal_to< T >::operator() ( const X &  ,
const Y &   
) const -> std::enable_if_t<!Private::are_equality_comparable_v<X, Y>, bool>
inlinenoexcept

The fallback implementation of operator()() if the types are not equality comparable using std::equal_to (i.e. no operator== implementation exists for this type). In this case, two values of type T are assumed to never be equal.

Returns
bool - Whether the values are equal - always false for this default implementation

Definition at line 100 of file property.h.


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

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDBindings
Reactive programming & data binding in C++
https://github.com/KDAB/KDBindings/
Generated by doxygen 1.9.1