Stratax 0.4.0rc1
Loading...
Searching...
No Matches
Compound.hpp File Reference

Internal result staging for compound operations on aliased arrays. More...

#include <stratax/core/dtypes/Concepts.hpp>
#include <cstddef>
#include <type_traits>
#include <vector>
Include dependency graph for Compound.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<bool Stage, Array A, typename Evaluate >
A & stratax::core::compound_detail::write_results (A &lhs, Evaluate evaluate)
 Writes computed values, staging them when storage may overlap.
 

Variables

template<typename A >
constexpr bool stratax::core::compound_detail::owns_storage = is_array<std::remove_cvref_t<A>>::value
 True for a Stratax container with unique owning element storage.
 

Detailed Description

Internal result staging for compound operations on aliased arrays.

Definition in file Compound.hpp.

Function Documentation

◆ write_results()

template<bool Stage, Array A, typename Evaluate >
A & stratax::core::compound_detail::write_results ( A &  lhs,
Evaluate  evaluate 
)

Writes computed values, staging them when storage may overlap.

Staging evaluates every logical result before the first write. Repeated destination offsets receive the last result in logical row-major order. Owning Stratax containers have unique storage and may skip staging when their other operand also owns storage or is a copied scalar.

Template Parameters
StageWhether all results must be computed before writing.
Parameters
lhsMutable destination array.
evaluateCallable returning the result at a logical flat index.
Returns
Reference to lhs.
Precondition
The callable does not modify either operand or its metadata.
Exceptions
Anyexception propagated by allocation, indexing, or evaluate.
Note
With staging, evaluation failure leaves the destination unchanged. Without staging, a throwing callable may leave earlier writes intact.
Complexity
O(n) evaluations and writes; O(n) extra element storage if staged.

Definition at line 34 of file Compound.hpp.

Variable Documentation

◆ owns_storage

template<typename A >
constexpr bool stratax::core::compound_detail::owns_storage = is_array<std::remove_cvref_t<A>>::value
inlineconstexpr

True for a Stratax container with unique owning element storage.

Definition at line 62 of file Compound.hpp.