From 03b25937ef2d59041b6e3e98ce27ce25549fced8 Mon Sep 17 00:00:00 2001 From: Dimitar Krastev Date: Sun, 30 Jun 2024 18:50:59 +0300 Subject: [PATCH] Deprecate getAndRemoveFromVector in PointerVector - Included "DeprecationUtils.h" in PointerVector.h for deprecation support. - Added deprecation notice to getAndRemoveFromVector within the pcpp namespace, advising the use of getAndDetach for memory safety. --- Common++/header/PointerVector.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Common++/header/PointerVector.h b/Common++/header/PointerVector.h index e611f3a569..96638da33f 100644 --- a/Common++/header/PointerVector.h +++ b/Common++/header/PointerVector.h @@ -6,6 +6,8 @@ #include #include +#include "DeprecationUtils.h" + /// @file /** @@ -249,7 +251,9 @@ namespace pcpp * The iterator is shifted to the following element after the removal is completed. * @return A pointer to the element which is no longer managed by the vector. It's user responsibility to free * it + * @deprecated Deprecated in favor of 'getAndDetach' as that function provides memory safety. */ + PCPP_DEPRECATED("Please use the memory safe 'getAndDetach' instead.") T* getAndRemoveFromVector(VectorIterator& position) { T* result = *position;