summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver/cc2/regression-tests/mixed-function-expression-with-pointer-capture.cpp2
blob: 3d72d7a16ca14c585183b14d482be13726710345 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <vector>
#include <ranges>
#include <string>
#include <span>
#include <algorithm>
#include <iostream>

main: () -> int = {
    vec: std::vector<std::string>
            = ("hello", "2023");

    y: std::string = "\n";
    std::ranges::for_each( vec, :(x) =
        std::cout << y&$*.c_str() << x << y&$*
    );

    callback := :(inout x) = x += "-ish";
    std::ranges::for_each( vec, callback );

    for vec do (str)
        std::cout << str << "\n";
}