logoalt Hacker News

dvh • today at 5:04 AM • 2 replies • view on HN

Time to remove c++ from your resumes old men!

    auto fib = [](this auto self, int n) -> int { return n < 2 ? n : self(n-1) + self(n-2); };
    auto v =  std::views::iota(0, 20) | std::views::transform(fib) | std::ranges::to<std::vector>();
    for (auto&& [i, x] : v | std::views::enumerate) std::println("{} -> {}", i, x);
    auto add = []<typename... Ts>(Ts&&... ts) { return (... + ts); };
    static_assert(add(1, 2, 3) == 6 && requires { std::format("{}", 'x'); });

Replies

dist-epoch • today at 2:10 PM

Why are you writing Perl, in a post about C++?

mystifyingpoi • today at 8:42 AM

Thanks, I hate it.