C++ lambda function error, while implementing dfs

Правка en5, от angry_pikachu, 2022-09-15 19:49:01

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en9 Английский angry_pikachu 2022-09-15 21:07:52 320
en8 Английский angry_pikachu 2022-09-15 21:04:11 304
en7 Английский 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 Английский angry_pikachu 2022-09-15 19:49:09 17 Reverted to en4
en5 Английский angry_pikachu 2022-09-15 19:49:01 17 Reverted to en2
en4 Английский angry_pikachu 2022-09-15 19:48:38 16
en3 Английский angry_pikachu 2022-09-15 19:46:32 1 Tiny change: ' long long \nnde[i] ' -> ' long long, \nnde[i] '
en2 Английский 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 Английский angry_pikachu 2022-09-15 19:45:06 479 Initial revision (published)