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

Concept for types that can assign values. More...

#include <concepts.hpp>

Concept definition

template<typename T>
concept tannic::Assignable = requires(T t, const std::byte* ptr, std::ptrdiff_t offset) {
{ t.assign(ptr, offset) } -> std::same_as<void>;
}
Concept for types that can assign values.
Definition: concepts.hpp:171

Detailed Description

Concept for types that can assign values.

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

void assign(const std::byte* ptr, std::ptrdiff_t offset);

This function must take a pointer to a raw byte buffer and an offset, then assign the corresponding value into the object.

This concept is mainly used internally when populating tensor elements from a memory buffer (e.g., in serialization, slicing, or low-level tensor initialization), and enables the usage of slices from custom data structures beside the Tensor class.