Capture lambda comme const CPP
//In c++17 using std::as_const:
[&best_string = std::as_const(best_string)](const string& s)
{
best_string = s; // fails
};
UBoiii
//In c++17 using std::as_const:
[&best_string = std::as_const(best_string)](const string& s)
{
best_string = s; // fails
};
//In c++14 using static_cast / const_cast:
[&best_string = static_cast<const std::string&>(best_string)](const string& s)
{
best_string = s; // fails
};