From f5def28faf9746dbb0be41412156448a3d3e8b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Delobel?= Date: Fri, 27 Jan 2023 16:12:42 +0100 Subject: [PATCH] loop is sometimes than algorithm --- main.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 498a4f2..94c7a91 100644 --- a/main.cpp +++ b/main.cpp @@ -93,7 +93,10 @@ int main() // we copied pointers in vanime, we didn't call 'new()' -- no need to delete from both collections - for_each(vanime.begin(), vanime.end(), [](auto *x) - { delete x; }); + //for_each(vanime.begin(), vanime.end(), [](auto *x) + //{ delete x; }); + + for(auto character : vanime ) + delete character; return 0; }