2013-07-17 19:24:07 +02:00
|
|
|
.. highlight:: c
|
|
|
|
|
2013-08-22 16:55:51 +02:00
|
|
|
.. _arr_reg_assign:
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-22 16:55:51 +02:00
|
|
|
Assignment
|
|
|
|
=========================
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
**Synopsis** ::
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
|
|
|
|
array & operator=(array const & X); (1)
|
|
|
|
|
|
|
|
template<ImmutableCuboidArray RHS> array & operator=(RHS const & X); (2)
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
The container have a quite general assignment operator.
|
|
|
|
We will illustrate it on the `array` class, it is the same for `matrix` and `vector`.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
* (1) just make a copy of X.
|
|
|
|
|
|
|
|
* (2) **RHS** can be anything that models the :ref:`ImmutableCuboidArray` concept
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-10-17 18:15:19 +02:00
|
|
|
e.g.: array, array_view, matrix, matrix_view,
|
2013-08-27 19:17:17 +02:00
|
|
|
but also formal expression (See , e.g. A+B), or any custom object of your choice.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-10-17 18:15:19 +02:00
|
|
|
`Effect`: all the elements viewed by the view are replaced
|
2013-08-27 19:17:17 +02:00
|
|
|
by the evaluation of RHS.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
.. warning::
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
In both cases, if needed, the container is resized.
|
|
|
|
|
|
|
|
Hence **assignment invalidates all pointers and views to it**.
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
Move assign operator
|
|
|
|
---------------------------
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
**Synopsis** ::
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
array & operator=(array && X);
|
2013-08-22 16:55:51 +02:00
|
|
|
|
2013-08-27 19:17:17 +02:00
|
|
|
Standard move assign operator.
|
|
|
|
Move the data of X as data of `*this`.
|