Lambda type decution

Revision en4, by Alexey, 2024-05-11 19:59:59

Could anyone hint me why this code fails to compile with error?

g.cpp: In lambda function: g.cpp:66:36: error: inconsistent types ‘bool’ and ‘std::_Bit_reference’ deduced for lambda return type 66 | return was[n - 1][m - 1];

If i explicitely do

const auto bfs = [&](int del) -> bool {

it compiles ok.

code

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English Alexey 2024-05-11 19:59:59 0 (published)
en3 English Alexey 2024-05-05 16:16:44 2 Tiny change: 'ompiles ok/\n\n\n<spo' -> 'ompiles ok.\n\n\n<spo'
en2 English Alexey 2024-05-05 16:16:32 102 (saved to drafts)
en1 English Alexey 2024-05-05 16:15:24 3341 Initial revision (published)