3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 11:43:47 +01:00
dft_tools/doc/reference/arrays/containers/swap_0.cpp
tayral edd1ff4529 Restructuring documentation.
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)
2014-10-18 12:21:08 +01:00

19 lines
569 B
C++

#include <triqs/arrays.hpp>
#include <iostream>
using triqs::arrays::vector;
using triqs::arrays::range;
int main() {
triqs::arrays::vector<double> V(3), W(4);
V() = 3;
W() = 4; // initialize
auto VV = V(range(0, 2));
auto VW = W(range(0, 2));
std::cout << "V = " << V << " W = " << W << " V view " << VV << " W view " << VW << std::endl;
swap(V, W);
std::cout << "V = " << V << " W = " << W << " V view " << VV << " W view " << VW << std::endl;
swap(VV, VW);
std::cout << "V = " << V << " W = " << W << " V view " << VV << " W view " << VW << std::endl;
}