Class univector¶
class univector<T, Size> base¶
template <typename T, size_t Size>
struct alignas(platform<>::maximum_vector_alignment) univector
: std::array<T, Size>,
univector_base<T, univector<T, Size>, is_vec_element<T>> { … } Class that represent data in KFR. Many KFR functions can take this class as an argument. Can inherit from std::vector, std::array or keep only reference to data and its size.
univector<float> is inherited from std::vector<float> univector<float, 10> is inherited from std::array<float, 10> univector<float, 0> contains only reference to dataTo convert a plain pointer to univector, call make_univector:
double* buffer;
size_t size;
univector<double, 0> v = make_univector(buffer, size);
// or pass result vector directly to a function:
some_function(make_univector(buffer, size));
typedef size_type ¶
using size_type = size_t Fully qualified name: kfr::univector<T, Size>::size_type
Declared at base/univector.hpp:381
constructor univector<T, Size>(univector<T, Size> &) ¶
univector(univector& v) Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(univector<T, Size> &)
Declared at base/univector.hpp:383
constructor univector<T, Size>(const univector<T, Size> &) ¶
univector(const univector& v) = default Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(const univector<T, Size> &)
Declared at base/univector.hpp:385
constructor univector<T, Size>(univector<T, Size> &&) ¶
univector(univector&&) noexcept = default Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(univector<T, Size> &&)
Declared at base/univector.hpp:386
function univector<T, Size>(Input &&) ¶
template <expression_argument Input>
univector(Input&& input) Constructs the vector and initializes it from an input expression.
| Input | Type of the input expression. |
| input | Expression to assign. |
Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(Input &&)
Declared at base/univector.hpp:391
function univector<T, Size>(const T &, const Args &...) ¶
template <typename... Args>
constexpr univector(const T& x, const Args&... args) noexcept
: std::array<T, Size> { … } Constructs the vector from a brace-enclosed list of values.
| x | First element value. |
| args | Remaining element values. |
Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(const T &, const Args &...)
Declared at base/univector.hpp:399
constructor univector<T, Size>() ¶
constexpr univector() noexcept(noexcept(std::array<T, Size>())) = default Fully qualified name: kfr::univector<T, Size>::univector<T, Size>()
Declared at base/univector.hpp:404
constructor univector<T, Size>(size_t, const T &) ¶
constexpr univector(size_t, const T& value) { … } Constructs the vector with Size copies of value.
| value | Value to fill the vector with. |
Fully qualified name: kfr::univector<T, Size>::univector<T, Size>(size_t, const T &)
Declared at base/univector.hpp:407
variable size_known ¶
constexpr static bool size_known = true True: the size is known at compile time.
Fully qualified name: kfr::univector<T, Size>::size_known
Declared at base/univector.hpp:408
variable static_size ¶
constexpr static size_t static_size = Size Compile-time size of the vector.
Fully qualified name: kfr::univector<T, Size>::static_size
Declared at base/univector.hpp:409
variable is_array ¶
constexpr static bool is_array = true True: backed by std::array.
Fully qualified name: kfr::univector<T, Size>::is_array
Declared at base/univector.hpp:410
variable is_array_ref ¶
constexpr static bool is_array_ref = false False: owns its data.
Fully qualified name: kfr::univector<T, Size>::is_array_ref
Declared at base/univector.hpp:411
variable is_vector ¶
constexpr static bool is_vector = false False: not dynamically sized.
Fully qualified name: kfr::univector<T, Size>::is_vector
Declared at base/univector.hpp:412
variable is_aligned ¶
constexpr static bool is_aligned = true True: aligned to the maximum vector alignment.
Fully qualified name: kfr::univector<T, Size>::is_aligned
Declared at base/univector.hpp:413
typedef value_type ¶
using value_type = T Fully qualified name: kfr::univector<T, Size>::value_type
Declared at base/univector.hpp:414
function get(size_t, value_type) ¶
value_type get(size_t index, value_type fallback_value) const noexcept Returns the element at index, or fallback_value if index is out of range.
| index | Index of the element to access. |
| fallback_value | Value returned when index is out of range. |
The element at index, or fallback_value. |
Fully qualified name: kfr::univector<T, Size>::get(size_t, value_type)
Declared at base/univector.hpp:420
function resize(size_t) ¶
void resize(size_t) noexcept No-op for API compatibility with dynamically sized vectors.
Fully qualified name: kfr::univector<T, Size>::resize(size_t)
Declared at base/univector.hpp:427
Fully qualified name: kfr::univector<T, Size>
Declared at base/univector.hpp:374
Class univector¶
class univector<T, tag_array_ref> base¶
template <typename T>
struct univector<T, tag_array_ref> : array_ref<T>,
univector_base<T, univector<T, tag_array_ref>, is_vec_element<T>> { … } Non-owning univector specialization that holds a reference to external data.
| T | Element type. May be const-qualified to expose a read-only view. |
typedef size_type ¶
using size_type = size_t Fully qualified name: kfr::univector<T, tag_array_ref>::size_type
Declared at base/univector.hpp:438
constructor univector<T, tag_array_ref>(univector<T, tag_array_ref> &) ¶
univector(univector& v) Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(univector<T, tag_array_ref> &)
Declared at base/univector.hpp:440
constructor univector<T, tag_array_ref>(const univector<T, tag_array_ref> &) ¶
univector(const univector& v) = default Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(const univector<T, tag_array_ref> &)
Declared at base/univector.hpp:442
constructor univector<T, tag_array_ref>(univector<T, tag_array_ref> &&) ¶
univector(univector&&) noexcept = default Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(univector<T, tag_array_ref> &&)
Declared at base/univector.hpp:443
constructor univector<T, tag_array_ref>(const array_ref<T> &) ¶
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(const array_ref<T> &)
Declared at base/univector.hpp:444
constructor univector<T, tag_array_ref>(array_ref<T> &&) ¶
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(array_ref<T> &&)
Declared at base/univector.hpp:445
function univector<T, tag_array_ref>(const univector<T, Tag> &) ¶
template <univector_tag Tag>
constexpr univector(const univector<T, Tag>& other) : array_ref<T>(other.data(), other.size()) { … } Constructs a reference from a const univector of any storage tag.
| Tag | Storage tag of the source vector. |
| other | Source vector to reference. |
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(const univector<T, Tag> &)
Declared at base/univector.hpp:451
function univector<T, tag_array_ref>(univector<T, Tag> &) ¶
template <univector_tag Tag>
constexpr univector(univector<T, Tag>& other) : array_ref<T>(other.data(), other.size()) { … } Constructs a reference from a mutable univector of any storage tag.
| Tag | Storage tag of the source vector. |
| other | Source vector to reference. |
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(univector<T, Tag> &)
Declared at base/univector.hpp:458
function univector<T, tag_array_ref>(const univector<U, Tag> &) ¶
template <typename U, univector_tag Tag>
requires(std::is_same_v<std::remove_const_t<T>, U> && std::is_const_v<T>)
constexpr univector(const univector<U, Tag>& other) : array_ref<T>(other.data(), other.size()) { … } Constructs a const reference from a const univector of a different element type. Only participates in overload resolution when T is const-qualified and the underlying element types match after removing const.
| U | Element type of the source vector. |
| Tag | Storage tag of the source vector. |
| other | Source vector to reference. |
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(const univector<U, Tag> &)
Declared at base/univector.hpp:469
function univector<T, tag_array_ref>(univector<U, Tag> &) ¶
template <typename U, univector_tag Tag>
requires(std::is_same_v<std::remove_const_t<T>, U> && std::is_const_v<T>)
constexpr univector(univector<U, Tag>& other) : array_ref<T>(other.data(), other.size()) { … } Constructs a const reference from a mutable univector of a different element type.
| U | Element type of the source vector. |
| Tag | Storage tag of the source vector. |
| other | Source vector to reference. |
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(univector<U, Tag> &)
Declared at base/univector.hpp:476
function univector<T, tag_array_ref>(univector<U, Tag> &&) ¶
template <typename U, univector_tag Tag>
requires(std::is_same_v<std::remove_const_t<T>, U> && std::is_const_v<T>)
constexpr univector(univector<U, Tag>&& other) : array_ref<T>(other.data(), other.size()) { … } Constructs a const reference by taking a reference to the data of a temporary univector.
| U | Element type of the source vector. |
| Tag | Storage tag of the source vector. |
| other | Source vector to reference. |
Fully qualified name: kfr::univector<T, tag_array_ref>::univector<T, tag_array_ref>(univector<U, Tag> &&)
Declared at base/univector.hpp:483
function resize(size_t) ¶
void resize(size_t) noexcept No-op for API compatibility with dynamically sized vectors.
Fully qualified name: kfr::univector<T, tag_array_ref>::resize(size_t)
Declared at base/univector.hpp:487
variable size_known ¶
constexpr static bool size_known = false False: the size is not known at compile time.
Fully qualified name: kfr::univector<T, tag_array_ref>::size_known
Declared at base/univector.hpp:488
variable is_array ¶
constexpr static bool is_array = false False: not backed by std::array.
Fully qualified name: kfr::univector<T, tag_array_ref>::is_array
Declared at base/univector.hpp:489
variable is_array_ref ¶
constexpr static bool is_array_ref = true True: holds a reference to external data.
Fully qualified name: kfr::univector<T, tag_array_ref>::is_array_ref
Declared at base/univector.hpp:490
variable is_vector ¶
constexpr static bool is_vector = false False: not dynamically sized.
Fully qualified name: kfr::univector<T, tag_array_ref>::is_vector
Declared at base/univector.hpp:491
variable is_aligned ¶
constexpr static bool is_aligned = false False: alignment of the referenced data is unknown.
Fully qualified name: kfr::univector<T, tag_array_ref>::is_aligned
Declared at base/univector.hpp:492
typedef value_type ¶
using value_type = std::remove_const_t<T> Fully qualified name: kfr::univector<T, tag_array_ref>::value_type
Declared at base/univector.hpp:493
function get(size_t, value_type) ¶
value_type get(size_t index, value_type fallback_value) const noexcept Returns the element at index, or fallback_value if index is out of range.
| index | Index of the element to access. |
| fallback_value | Value returned when index is out of range. |
The element at index, or fallback_value. |
Fully qualified name: kfr::univector<T, tag_array_ref>::get(size_t, value_type)
Declared at base/univector.hpp:499
function ref() ¶
univector<T, tag_array_ref>& ref() && Returns *this as a reference. Intended for use on rvalues to forward the contained reference without copying.
Fully qualified name: kfr::univector<T, tag_array_ref>::ref()
Declared at base/univector.hpp:507
Fully qualified name: kfr::univector<T, tag_array_ref>
Declared at base/univector.hpp:433
Class univector¶
class univector<T, tag_dynamic_vector> base¶
template <typename T>
struct univector<T, tag_dynamic_vector>
: std::vector<T, data_allocator<T>>,
univector_base<T, univector<T, tag_dynamic_vector>, is_vec_element<T>> { … } Dynamically sized, owning univector backed by std::vector using KFR's data_allocator . Memory is aligned to the maximum vector alignment.
| T | Element type. Must not be const-qualified. |
typedef size_type ¶
using size_type = size_t Fully qualified name: kfr::univector<T, tag_dynamic_vector>::size_type
Declared at base/univector.hpp:522
constructor univector<T, tag_dynamic_vector>(univector<T, tag_dynamic_vector> &) ¶
univector(univector& v) Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(univector<T, tag_dynamic_vector> &)
Declared at base/univector.hpp:524
constructor univector<T, tag_dynamic_vector>(const univector<T, tag_dynamic_vector> &) ¶
univector(const univector& v) = default Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(const univector<T, tag_dynamic_vector> &)
Declared at base/univector.hpp:526
constructor univector<T, tag_dynamic_vector>(univector<T, tag_dynamic_vector> &&) ¶
univector(univector&&) noexcept = default Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(univector<T, tag_dynamic_vector> &&)
Declared at base/univector.hpp:527
function univector<T, tag_dynamic_vector>(Input &&) ¶
template <expression_argument Input>
univector(Input&& input) Constructs the vector from an input expression, resizing to the expression's size. The expression must be finite and have at most one dimension.
| Input | Type of the input expression. |
| input | Expression to assign. |
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(Input &&)
Declared at base/univector.hpp:533
constructor univector<T, tag_dynamic_vector>() ¶
constexpr univector() noexcept(noexcept(std::vector<T, data_allocator<T>>())) = default Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>()
Declared at base/univector.hpp:544
constructor univector<T, tag_dynamic_vector>(const std::vector<T, data_allocator<T>> &) ¶
constexpr univector(const std::vector<T, data_allocator<T>>& other)
: std::vector<T, data_allocator<T>>(other) { … } Copy-constructs from a std::vector using the same allocator.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(const std::vector<T, data_allocator<T>> &)
Declared at base/univector.hpp:546
constructor univector<T, tag_dynamic_vector>(std::vector<T, data_allocator<T>> &&) ¶
constexpr univector(std::vector<T, data_allocator<T>>&& other)
: std::vector<T, data_allocator<T>>(std::move(other)) { … } Move-constructs from a std::vector using the same allocator.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(std::vector<T, data_allocator<T>> &&)
Declared at base/univector.hpp:551
constructor univector<T, tag_dynamic_vector>(const array_ref<T> &) ¶
constexpr univector(const array_ref<T>& other)
: std::vector<T, data_allocator<T>>(other.begin(), other.end()) { … } Constructs from a mutable array_ref by copying its elements.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(const array_ref<T> &)
Declared at base/univector.hpp:556
constructor univector<T, tag_dynamic_vector>(const array_ref<const T> &) ¶
constexpr univector(const array_ref<const T>& other)
: std::vector<T, data_allocator<T>>(other.begin(), other.end()) { … } Constructs from a const array_ref by copying its elements.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(const array_ref<const T> &)
Declared at base/univector.hpp:561
function univector<T, tag_dynamic_vector>(const std::vector<T, Allocator> &) ¶
template <typename Allocator>
constexpr univector(const std::vector<T, Allocator>&) Deleted overload to prevent construction from a std::vector with a foreign allocator.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(const std::vector<T, Allocator> &)
Declared at base/univector.hpp:567
function univector<T, tag_dynamic_vector>(std::vector<T, Allocator> &&) ¶
template <typename Allocator>
constexpr univector(std::vector<T, Allocator>&&) Deleted overload to prevent construction from a std::vector with a foreign allocator.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::univector<T, tag_dynamic_vector>(std::vector<T, Allocator> &&)
Declared at base/univector.hpp:570
variable size_known ¶
constexpr static bool size_known = false False: the size is not known at compile time.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::size_known
Declared at base/univector.hpp:571
variable is_array ¶
constexpr static bool is_array = false False: not backed by std::array.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::is_array
Declared at base/univector.hpp:572
variable is_array_ref ¶
constexpr static bool is_array_ref = false False: owns its data.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::is_array_ref
Declared at base/univector.hpp:573
variable is_vector ¶
constexpr static bool is_vector = true True: dynamically sized.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::is_vector
Declared at base/univector.hpp:574
variable is_aligned ¶
constexpr static bool is_aligned = true True: aligned to the maximum vector alignment.
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::is_aligned
Declared at base/univector.hpp:575
typedef value_type ¶
using value_type = T Fully qualified name: kfr::univector<T, tag_dynamic_vector>::value_type
Declared at base/univector.hpp:576
function get(size_t, value_type) ¶
value_type get(size_t index, value_type fallback_value) const noexcept Returns the element at index, or fallback_value if index is out of range.
| index | Index of the element to access. |
| fallback_value | Value returned when index is out of range. |
The element at index, or fallback_value. |
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::get(size_t, value_type)
Declared at base/univector.hpp:582
function operator=(const univector<T, tag_dynamic_vector> &) ¶
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::operator=(const univector<T, tag_dynamic_vector> &)
Declared at base/univector.hpp:603
function operator=(univector<T, tag_dynamic_vector> &&) ¶
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::operator=(univector<T, tag_dynamic_vector> &&)
Declared at base/univector.hpp:604
function operator=(univector<T, tag_dynamic_vector> &) ¶
Copy assignment from a mutable univector (forwards to the const overload).
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::operator=(univector<T, tag_dynamic_vector> &)
Declared at base/univector.hpp:607
function operator=(Input &&) ¶
template <expression_argument Input>
KFR_MEM_INTRINSIC univector& operator=(Input&& input) Assigns an expression to the vector, resizing it when the expression has a finite size.
| Input | Type of the input expression. |
| input | Expression to assign. |
Reference to *this. |
Fully qualified name: kfr::univector<T, tag_dynamic_vector>::operator=(Input &&)
Declared at base/univector.hpp:613
Fully qualified name: kfr::univector<T, tag_dynamic_vector>
Declared at base/univector.hpp:514