summaryrefslogtreecommitdiffstats
path: root/tests/manual/clients/vector.cpp
blob: 20da9b970d677c9f061cb2b07dc2e9b47240e425 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// SPDX-License-Identifier: LGPL-2.1-or-later

#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>

int main()
{
    std::vector<double> v;
    std::generate_n(std::back_inserter(v), 100000, [i = 0] () mutable {
        auto x = std::sin(i++);
        auto y = std::cos(i++);
        return std::abs(std::complex<double>(x, y));
    });
    auto sum = std::accumulate(v.begin(), v.end(), 0.0);
    return sum > 0;
}