Intuition2.0's blog

By Intuition2.0, history, 3 weeks ago, In English

With respect to this problem : 2050G - Tree Destruction

Using vector of vector, compiled successfully and giving correct output
But when trying the same with array of vectors, it doesn't compile

Error by compiler -> error: use of deleted function 'main()::<lambda(auto:28, int, int)>::~<lambda>()' <lambda(auto:28, int, int)>::~<lambda>()' is implicitly deleted because the default definition would be ill-formed:

I want to know why this is happening. Can someone please tell me the reason behind this unknown behavior of lambda function ?

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Intuition2.0 (previous revision, new revision, compare).

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by Intuition2.0 (previous revision, new revision, compare).

»
3 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

An array of size n requires the n to be a compile-time constant while the vector is dynamically sized.

If you provide n at runtime with std::cin, the compiler does not know its value when constructing the array, leading to a compilation error.

This code 295344654 compiles fine, although TLEs because we are using global initialisation for a big graph for each test case, hence use a vector of vector for the graph in this situation 295345367