From 3b2bbb48142f1c8f144d8557715e94cc7957f99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Delobel?= Date: Sun, 5 Feb 2023 00:28:28 +0100 Subject: [PATCH] =?UTF-8?q?Pas=20besoin=20des=20RTTI=20+=20d=C3=A9couvrir?= =?UTF-8?q?=20le=20remove=5Fif=20si=20particulier...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/main.cpp b/main.cpp index 17df680..f4633f5 100644 --- a/main.cpp +++ b/main.cpp @@ -118,22 +118,10 @@ int main() } cout << endl; - auto begin = vanime.begin(); - auto end = vanime.end(); - - for (auto p = begin; p != end; ++p) - { - cout << "typeid(character) == typeid(Kenny): " - << typeid(*p).name() << "==" << typeid(Kenny).name() << ": " - << (typeid(*p) == typeid(Kenny)) - << endl << endl; - - // FIXME - if (typeid(*p) == typeid(Kenny)) - { - vanime.erase(p); - } - } + auto found = remove_if(std::begin(vanime), std::end(vanime), + [](Personnage *p){return dynamic_cast(p) != nullptr; } + ); + vanime.erase(found, std::end(vanime)); for (Personnage *character: anime) {