Alexey's blog

By Alexey, history, 8 months ago, In English

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

Full text and comments »

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

By Alexey, history, 2 years ago, translation, In English

I have two submissions of the same code 169242883 and 169242938 of the problem 812 E one with compiler Visual C++ 17, another with compiler GNU C++ 17.

Visual C++ gives TLE, GNU oks. Looks like sync_with_stdio doesn't work properly in Visual C++. Has anybody faced this problem before?

Upd:: this seems to be an answer. VC++ in fact just sets flag and doesn't break the sync between C and C++ streams, which btw is allowed by the standard.

Full text and comments »

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