From 9941a616cbba8ad5dec07bdf908a1d08d81e568e Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 10 Jul 2006 16:51:19 +0000 Subject: If you ask me, it looks a hell of a lot tidier without forcing the cast. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4277 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/base.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'include/base.h') diff --git a/include/base.h b/include/base.h index d3cc77e05..ac5fec63f 100644 --- a/include/base.h +++ b/include/base.h @@ -94,7 +94,20 @@ public: * * @return If you provide a non-existent key name, the function returns NULL, otherwise a pointer to the item referenced by the key is returned. */ - char* GetExt(const std::string &key); + template bool GetExt(const std::string &key, T* &p) + { + ExtensibleStore::iterator iter = this->Extension_Items.find(key); + if(iter != this->Extension_Items.end()) + { + p = (T*)iter->second; + return true; + } + else + { + return false; + } + } + //char* GetExt(const std::string &key); /** Get a list of all extension items names. * -- cgit v1.2.3