Sacha's blog

By Sacha, history, 9 months ago, In English

Will vector<int> be copied when f[0] is called?

#include <bits/stdc++.h>
using namespace std;
signed main() {
    vector<function<void(const vector<int>)>> f = {
            [&] (const vector<int>& v) -> void {

            }
    };
}
Spoiler

Why would anyone use vector<function> in CP?

This task with prefix sums for 8 types of triangles xD

TL

1-char fix (line 135)

  • Vote: I like it
  • +6
  • Vote: I do not like it