From 20f2d66c519896dc98be040bd7cb114f2c1cecbf Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Mon, 9 Oct 2017 14:12:56 +0200 Subject: [PATCH] feat(Utils): getPtr can deal with references --- include/linphone/utils/utils.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/linphone/utils/utils.h b/include/linphone/utils/utils.h index 91d36cc53..c2f5d19df 100644 --- a/include/linphone/utils/utils.h +++ b/include/linphone/utils/utils.h @@ -32,6 +32,11 @@ LINPHONE_BEGIN_NAMESPACE namespace Utils { + template + LINPHONE_PUBLIC constexpr T *getPtr (std::shared_ptr &object) { + return object.get(); + } + template LINPHONE_PUBLIC constexpr T *getPtr (const std::shared_ptr &object) { return object.get(); @@ -43,13 +48,8 @@ namespace Utils { } template - LINPHONE_PUBLIC constexpr const T *getPtr (const std::shared_ptr &object) { - return object.get(); - } - - template - LINPHONE_PUBLIC constexpr const T *getPtr (const T *object) { - return object; + LINPHONE_PUBLIC constexpr T *getPtr (T &object) { + return &object; } LINPHONE_PUBLIC bool iequals (const std::string &a, const std::string &b);