diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-10 16:51:19 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-07-10 16:51:19 +0000 |
commit | 9941a616cbba8ad5dec07bdf908a1d08d81e568e (patch) | |
tree | f8699db21a5e344e9d47da7aec7d8e646af3c4f2 /include/base.h | |
parent | 91436d31a4ab6657012743285a1e635073e8966f (diff) |
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
Diffstat (limited to 'include/base.h')
-rw-r--r-- | include/base.h | 15 |
1 files changed, 14 insertions, 1 deletions
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<typename T> 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. * |