8
Захоплення лямбда як посилання на const?
Чи можливо зафіксувати через посилання const в лямбдаському виразі? Я хочу, щоб завдання, позначене нижче, не вдалося, наприклад: #include <cstdlib> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { string strings[] = { "hello", "world" }; static const size_t num_strings = sizeof(strings)/sizeof(strings[0]); string best_string = "foo"; for_each( …