From a6ace6bd15f2e83a84c2ff6ca7c64fc6306aa665 Mon Sep 17 00:00:00 2001 From: Kbz-8 Date: Tue, 23 Jan 2024 17:37:06 +0100 Subject: [PATCH] je suis bete --- includes/channel.hpp | 15 ++++++++++++--- includes/unstd/shared_ptr.hpp | 4 ++-- includes/unstd/shared_ptr.ipp | 2 +- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/includes/channel.hpp b/includes/channel.hpp index bf0ac7e..3f62ec8 100644 --- a/includes/channel.hpp +++ b/includes/channel.hpp @@ -6,7 +6,7 @@ /* By: vvaas +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/21 10:34:25 by maldavid #+# #+# */ -/* Updated: 2024/01/23 16:48:15 by vvaas ### ########.fr */ +/* Updated: 2024/01/23 17:35:49 by maldavid ### ########.fr */ /* */ /******************************************************************************/ @@ -17,8 +17,17 @@ #include #include #include + namespace irc { + struct ClientCmp + { + bool operator()(const unstd::SharedPtr& lhs, const unstd::SharedPtr& rhs) const + { + return lhs.get() < rhs.get(); + } + }; + class Channel { public: @@ -44,8 +53,8 @@ namespace irc ~Channel(); private: - std::set > _clients; - std::set > _operators; + std::set, ClientCmp> _clients; + std::set, ClientCmp> _operators; const std::string _name; std::string _password; std::string _topic; diff --git a/includes/unstd/shared_ptr.hpp b/includes/unstd/shared_ptr.hpp index 98400d7..9b32c31 100644 --- a/includes/unstd/shared_ptr.hpp +++ b/includes/unstd/shared_ptr.hpp @@ -6,7 +6,7 @@ /* By: maldavid +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/01/20 10:09:02 by maldavid #+# #+# */ -/* Updated: 2024/01/21 12:27:07 by maldavid ### ########.fr */ +/* Updated: 2024/01/23 17:35:24 by maldavid ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,7 +34,7 @@ namespace unstd bool operator==(T* ptr); T& operator*(); T* operator->(); - T* get(); + T* get() const; void swap(SharedPtr& rhs); void reset(T* ptr = NULL); ~SharedPtr(); diff --git a/includes/unstd/shared_ptr.ipp b/includes/unstd/shared_ptr.ipp index 80880b9..32c65ac 100644 --- a/includes/unstd/shared_ptr.ipp +++ b/includes/unstd/shared_ptr.ipp @@ -69,7 +69,7 @@ namespace unstd } template - T* SharedPtr::get() + T* SharedPtr::get() const { return _ptr; }