mirror of
https://github.com/triqs/dft_tools
synced 2024-11-01 11:43:47 +01:00
edd1ff4529
A first general restructuration of the doc according to the pattern [tour|tutorial|reference]. In the reference part, objects are documented per topic. In each topic, [definition|c++|python|hdf5] (not yet implemented)
45 lines
1.1 KiB
ReStructuredText
45 lines
1.1 KiB
ReStructuredText
.. highlight:: c
|
|
|
|
.. _arr_reg_assign:
|
|
|
|
Assignment
|
|
=========================
|
|
|
|
|
|
**Synopsis** ::
|
|
|
|
|
|
array & operator=(array const & X); (1)
|
|
|
|
template<ImmutableCuboidArray RHS> array & operator=(RHS const & X); (2)
|
|
|
|
The container have a quite general assignment operator.
|
|
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
|
|
|
|
* (1) just make a copy of X.
|
|
|
|
* (2) **RHS** can be anything that models the :ref:`ImmutableCuboidArray` concept
|
|
|
|
e.g.: array, array_view, matrix, matrix_view,
|
|
but also formal expression (See , e.g. A+B), or any custom object of your choice.
|
|
|
|
`Effect`: all the elements viewed by the view are replaced
|
|
by the evaluation of RHS.
|
|
|
|
.. warning::
|
|
|
|
In both cases, if needed, the container is resized.
|
|
|
|
Hence **assignment invalidates all pointers and views to it**.
|
|
|
|
|
|
Move assign operator
|
|
---------------------------
|
|
|
|
**Synopsis** ::
|
|
|
|
array & operator=(array && X);
|
|
|
|
Standard move assign operator.
|
|
Move the data of X as data of `*this`.
|