C++ lambda function error, while implementing dfs

Revision en2, by angry_pikachu, 2022-09-15 19:46:03

I am getting error

prog.cpp: In lambda function:

prog.cpp:118:28: error: use of ‘dfs’ before deduction of ‘auto’

118 | for(ll it: nde[i]) dfs(it,fren[i]);

In this code , ll means long long nde[i] is a vector of int

auto dfs = [&](int i,int x)->void{ fren[i]+=x; for(ll it: nde[i]) dfs(it,fren[i]); }; dfs(0,0);

Writing a blog in codeforces for first time

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English angry_pikachu 2022-09-15 21:07:52 320
en8 English angry_pikachu 2022-09-15 21:04:11 304
en7 English angry_pikachu 2022-09-15 20:05:12 27 Tiny change: 'ime \n\n\n\n\n' -> 'ime \n\n\nC++ 17 online compiler \n\n\n\n'
en6 English angry_pikachu 2022-09-15 19:49:09 17 Reverted to en4
en5 English angry_pikachu 2022-09-15 19:49:01 17 Reverted to en2
en4 English angry_pikachu 2022-09-15 19:48:38 16
en3 English angry_pikachu 2022-09-15 19:46:32 1 Tiny change: ' long long \nnde[i] ' -> ' long long, \nnde[i] '
en2 English angry_pikachu 2022-09-15 19:46:03 11 Tiny change: ' of int \n`\nauto ' -> ' of int \n\n\n\n\n\n`\nauto '
en1 English angry_pikachu 2022-09-15 19:45:06 479 Initial revision (published)