TRIQS/nda 1.3.0
Multi-dimensional array library for C++
|
Automatic assignment uses lazy expressions and placeholders to simplify assigning values to multi-dimensional arrays/views and other container like objects.
The following example shows how to fill a 2-dimensional nda::array of size 3 with the values 0, 1, 2, 10, 11 and 12:
operator<<
in line 3 calls the clef_auto_assign
overload for nda::array objects.We can also use auto assignment to fill a std::vector of size 3 with the values 10, 20 and 30:
operator<<
in line 3 calls the clef_auto_assign_subscript
overload for std::vector objects.Functions | |
template<typename Tag , typename... Childs, typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign (expr< Tag, Childs... > const &ex, RHS const &rhs) |
Overload of clef_auto_assign function for generic expressions. | |
template<typename T , typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign (expr< tags::terminal, T > const &ex, RHS &&rhs) |
Overload of clef_auto_assign function for terminal expressions. | |
template<typename T , typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign (std::reference_wrapper< T > wrapper, RHS &&rhs) |
Overload of clef_auto_assign function for std::reference_wrapper objects. | |
template<Array A, typename F > | |
void | nda::clef_auto_assign (A &&a, F &&f) |
Overload of nda::clef::clef_auto_assign function for nda::Array objects. | |
template<typename Tag , typename... Childs, typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign_subscript (expr< Tag, Childs... > const &ex, RHS const &rhs) |
Overload of clef_auto_assign_subscript function for generic expressions. | |
template<typename T , typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign_subscript (expr< tags::terminal, T > const &ex, RHS &&rhs) |
Overload of clef_auto_assign_subscript function for terminal expressions. | |
template<typename T , typename RHS > | |
__inline__ void | nda::clef::clef_auto_assign_subscript (std::reference_wrapper< T > wrapper, RHS &&rhs) |
Overload of clef_auto_assign_subscript function for std::reference_wrapper objects. | |
template<typename T , typename F > | |
void | nda::clef::clef_auto_assign_subscript (std::vector< T > &v, F f) |
Overload of clef_auto_assign_subscript function for std::vector. | |
template<typename F , typename RHS , int... Is> | |
__inline__ void | nda::clef::operator<< (expr< tags::function, F, placeholder< Is >... > const &ex, RHS &&rhs) |
Assign values to the underlying object of a lazy function call expression. | |
template<typename T , typename RHS , int... Is> | |
__inline__ void | nda::clef::operator<< (expr< tags::subscript, T, placeholder< Is >... > const &ex, RHS &&rhs) |
Assign values to the underlying object of a lazy subscript expression. | |
__inline__ void nda::clef::clef_auto_assign | ( | expr< Tag, Childs... > const & | ex, |
RHS const & | rhs ) |
#include <nda/clef/auto_assign.hpp>
Overload of clef_auto_assign
function for generic expressions.
It calls the specialized operator<<
function for the given expression and right-hand side.
Tag | Tag of the expression. |
Childs | Types of the child nodes. |
RHS | Type of the right-hand side. |
ex | nda::clef::expr object. |
rhs | Right-hand side object. |
Definition at line 83 of file auto_assign.hpp.
__inline__ void nda::clef::clef_auto_assign | ( | expr< tags::terminal, T > const & | ex, |
RHS && | rhs ) |
#include <nda/clef/auto_assign.hpp>
Overload of clef_auto_assign
function for terminal expressions.
Simply calls the clef_auto_assign
for the child node of the expression.
T | Type of the expression's child node. |
RHS | Type of the right-hand side. |
ex | nda::clef::expr object with the nda::clef::tags::terminal tag. |
rhs | Right-hand side object. |
Definition at line 67 of file auto_assign.hpp.
__inline__ void nda::clef::clef_auto_assign | ( | std::reference_wrapper< T > | wrapper, |
RHS && | rhs ) |
#include <nda/clef/auto_assign.hpp>
Overload of clef_auto_assign
function for std::reference_wrapper objects.
Simply calls the clef_auto_assign
for the object contained in the wrapper.
T | Type of the object stored in the std::reference_wrapper. |
RHS | Type of the right-hand side. |
wrapper | std::reference_wrapper object. |
rhs | Right-hand side object. |
Definition at line 52 of file auto_assign.hpp.
void nda::clef_auto_assign | ( | A && | a, |
F && | f ) |
#include <nda/basic_functions.hpp>
Overload of nda::clef::clef_auto_assign function for nda::Array objects.
A | nda::Array type. |
F | Callable type. |
a | nda::Array object. |
f | Callable object. |
Definition at line 532 of file basic_functions.hpp.
__inline__ void nda::clef::clef_auto_assign_subscript | ( | expr< Tag, Childs... > const & | ex, |
RHS const & | rhs ) |
#include <nda/clef/auto_assign_subscript.hpp>
Overload of clef_auto_assign_subscript
function for generic expressions.
It calls the specialized operator<<
function for the given expression and right-hand side.
Tag | Tag of the expression. |
Childs | Types of the child nodes. |
RHS | Type of the right-hand side. |
ex | nda::clef::expr object. |
rhs | Right-hand side object. |
Definition at line 87 of file auto_assign_subscript.hpp.
__inline__ void nda::clef::clef_auto_assign_subscript | ( | expr< tags::terminal, T > const & | ex, |
RHS && | rhs ) |
#include <nda/clef/auto_assign_subscript.hpp>
Overload of clef_auto_assign_subscript
function for terminal expressions.
Simply calls the clef_auto_assign_subscript
for the child node of the expression.
T | Type of the expression's child node. |
RHS | Type of the right-hand side. |
ex | nda::clef::expr object with the nda::clef::tags::terminal tag. |
rhs | Right-hand side object. |
Definition at line 71 of file auto_assign_subscript.hpp.
__inline__ void nda::clef::clef_auto_assign_subscript | ( | std::reference_wrapper< T > | wrapper, |
RHS && | rhs ) |
#include <nda/clef/auto_assign_subscript.hpp>
Overload of clef_auto_assign_subscript
function for std::reference_wrapper objects.
Simply calls the clef_auto_assign_subscript
for the object contained in the wrapper.
T | Type of the object stored in the std::reference_wrapper. |
RHS | Type of the right-hand side. |
wrapper | std::reference_wrapper object. |
rhs | Right-hand side object. |
Definition at line 56 of file auto_assign_subscript.hpp.
void nda::clef::clef_auto_assign_subscript | ( | std::vector< T > & | v, |
F | f ) |
#include <nda/clef/adapters/vector.hpp>
Overload of clef_auto_assign_subscript
function for std::vector.
T | Value type of the std::vector. |
F | Callable type. |
v | std::vector object. |
f | Callable object. |
Definition at line 61 of file vector.hpp.
__inline__ void nda::clef::operator<< | ( | expr< tags::function, F, placeholder< Is >... > const & | ex, |
RHS && | rhs ) |
#include <nda/clef/auto_assign.hpp>
Assign values to the underlying object of a lazy function call expression.
This calls the clef_auto_assign
overload for the underlying object of the given expression using ADL. It has to be implemented for all supported types.
F | Type of the callable object in the function call expression. |
RHS | Type of the right-hand side. |
Is | Integer labels of the placeholders in the function call expression. |
ex | nda::clef::expr object with the nda::clef::tags::function tag. |
rhs | Right-hand side object. |
Definition at line 106 of file auto_assign.hpp.
__inline__ void nda::clef::operator<< | ( | expr< tags::subscript, T, placeholder< Is >... > const & | ex, |
RHS && | rhs ) |
#include <nda/clef/auto_assign_subscript.hpp>
Assign values to the underlying object of a lazy subscript expression.
This calls the clef_auto_assign_subscript
overload for the underlying object of the given expression using ADL. It has to be implemented for all supported types.
T | Type of the subscripted object in the subscript expression. |
RHS | Type of the right-hand side. |
Is | Integer labels of the placeholders in the subscript expression. |
ex | nda::clef::expr object with the nda::clef::tags::subscript tag. |
rhs | Right-hand side object. |
Definition at line 110 of file auto_assign_subscript.hpp.