X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fstdalgo.h;h=c0baa9dd8ef843de3050dfea8c1f8d435326032f;hb=5860247c3bf664daac1234f47f68ed30402fe13d;hp=d69f50bb244afd71537ac750c54d1c1dd4980a6f;hpb=c6e40d36b42a7ebf832c3a57d2816a47ee9c9a76;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/include/stdalgo.h b/include/stdalgo.h index d69f50bb2..c0baa9dd8 100644 --- a/include/stdalgo.h +++ b/include/stdalgo.h @@ -1,7 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2014 Attila Molnar + * Copyright (C) 2018, 2020 Sadie Powell + * Copyright (C) 2014, 2016, 2018 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -181,6 +182,17 @@ namespace stdalgo std::for_each(cont.begin(), cont.end(), defaultdeleter()); } + /** Deletes a object and zeroes the memory location that pointed to it. + * @param pr A reference to the pointer that contains the object to delete. + */ + template + void delete_zero(T*& pr) + { + T* p = pr; + pr = NULL; + delete p; + } + /** * Remove an element from a container * @param cont Container to remove the element from