From 7bdaa89ccef864d36f1e1adce535179d9e5fadce Mon Sep 17 00:00:00 2001 From: Benjamin Paassen Date: Fri, 16 Jan 2015 12:29:30 +0100 Subject: made getUid work using a rather ugly const cast. Unfortunately this could not be prevented. --- src/core/managed/Managed.hpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/core/managed') diff --git a/src/core/managed/Managed.hpp b/src/core/managed/Managed.hpp index 48198c2..e98e95e 100644 --- a/src/core/managed/Managed.hpp +++ b/src/core/managed/Managed.hpp @@ -99,7 +99,17 @@ public: * * @return the unique id of the object. */ - ManagedUid getUid() { return mgr.getUid(this); } + ManagedUid getUid() const + { + /* + * Dear Bjarne Stroustroup, dear gods of C++, please excuse this + * const_cast, for I did try other means but was not able to apply them + * and in my despair turned to this folly, this ugliness, this heresy! + * I pledge my life to better programming and promise that this cast + * will do no harm to anyone. + */ + return mgr.getUid(const_cast(this)); + } /** * Acquires a reference to the object wraped in the given handle -- creates -- cgit v1.2.3