Tannic
A C++ Tensor Library
Loading...
Searching...
No Matches
tannic::Comparable Concept Reference

Concept for types that can compare their value. More...

#include <concepts.hpp>

Concept definition

template<typename T>
concept tannic::Comparable = requires(const T t, const std::byte* ptr, std::ptrdiff_t offset) {
{ t.compare(ptr, offset) } -> std::same_as<bool>;
}
Concept for types that can compare their value.
Definition: concepts.hpp:195

Detailed Description

Concept for types that can compare their value.

A type T satisfies this concept if it provides a method:

bool compare(const std::byte* ptr, std::ptrdiff_t offset) const;

This function must take a pointer to a raw byte buffer and an offset, then return true if the object is equal to the value at that memory location, or false otherwise.

This concept is mainly used internally when comparing tensor elements, and enables the usage of slices from custom data structures beside the Tensor class.