summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-11-21 00:20:36 -0500
committerAdam <Adam@anope.org>2010-12-12 19:35:30 -0500
commit7790a7f98c56a16e6fed2bf51168881902880c62 (patch)
tree1c1854ec1ef603385c7c85fb967e0500fbc55315 /include
parent246f44b9888161aecefc81f0ff17ddd893287e3c (diff)
Allow the patricia tree to store non-pointers
Diffstat (limited to 'include')
-rw-r--r--include/bots.h4
-rw-r--r--include/patricia.h22
-rw-r--r--include/services.h2
-rw-r--r--include/users.h4
4 files changed, 16 insertions, 16 deletions
diff --git a/include/bots.h b/include/bots.h
index 2c1757a47..bbd40a236 100644
--- a/include/bots.h
+++ b/include/bots.h
@@ -12,8 +12,8 @@
class BotInfo;
-extern CoreExport patricia_tree<BotInfo, std::equal_to<ci::string> > BotListByNick;
-extern CoreExport patricia_tree<BotInfo> BotListByUID;
+extern CoreExport patricia_tree<BotInfo *, std::equal_to<ci::string> > BotListByNick;
+extern CoreExport patricia_tree<BotInfo *> BotListByUID;
/** Flags settable on a bot
*/
diff --git a/include/patricia.h b/include/patricia.h
index 73f5c22b9..fc28f4195 100644
--- a/include/patricia.h
+++ b/include/patricia.h
@@ -8,9 +8,9 @@ template<typename Data> struct patricia_elem
{
unsigned int bit;
patricia_elem<Data> *up, *one, *zero;
- typename std::list<Data *>::iterator node;
+ typename std::list<Data>::iterator node;
Anope::string key;
- Data *data;
+ Data data;
};
template<typename Data, typename Compare = std::equal_to<Anope::string> >
@@ -19,7 +19,7 @@ class patricia_tree
Compare comp;
patricia_elem<Data> *root;
- std::list<Data *> list;
+ std::list<Data> list;
public:
@@ -34,8 +34,8 @@ class patricia_tree
this->erase(this->root->key);
}
- typedef typename std::list<Data *>::iterator iterator;
- typedef typename std::list<Data *>::const_iterator const_iterator;
+ typedef typename std::list<Data>::iterator iterator;
+ typedef typename std::list<Data>::const_iterator const_iterator;
inline iterator begin() { return this->list.begin(); }
inline iterator end() { return this->list.end(); }
@@ -43,13 +43,13 @@ class patricia_tree
inline const const_iterator begin() const { return this->list.begin(); }
inline const const_iterator end() const { return this->list.end(); }
- inline Data *front() { return this->list.front(); }
- inline Data *back() { return this->list.back(); }
+ inline Data front() { return this->list.front(); }
+ inline Data back() { return this->list.back(); }
inline size_t size() const { return this->list.size(); }
inline bool empty() const { return this->list.empty(); }
- Data *find(const Anope::string &key)
+ Data find(const Anope::string &key)
{
size_t keylen = key.length();
patricia_elem<Data> *prev = NULL, *cur = this->root;
@@ -72,7 +72,7 @@ class patricia_tree
return NULL;
}
- void insert(const Anope::string &key, Data *data)
+ void insert(const Anope::string &key, Data data)
{
if (key.empty() || data == NULL)
throw CoreExport;
@@ -144,7 +144,7 @@ class patricia_tree
newelem->node = this->list.begin();
}
- Data *erase(const Anope::string &key)
+ Data erase(const Anope::string &key)
{
size_t keylen = key.length();
patricia_elem<Data> *prev = NULL, *cur = this->root;
@@ -200,7 +200,7 @@ class patricia_tree
this->list.erase(cur->node);
- Data *data = cur->data;
+ Data data = cur->data;
delete cur;
return data;
diff --git a/include/services.h b/include/services.h
index 4d2401883..1ebdf608a 100644
--- a/include/services.h
+++ b/include/services.h
@@ -850,7 +850,7 @@ struct Exception
/*************************************************************************/
-extern CoreExport patricia_tree<Session> SessionList;
+extern CoreExport patricia_tree<Session *> SessionList;
struct Session
{
diff --git a/include/users.h b/include/users.h
index d9f47792f..b6e8ec612 100644
--- a/include/users.h
+++ b/include/users.h
@@ -8,8 +8,8 @@
#ifndef USERS_H
#define USERS_H
-extern CoreExport patricia_tree<User, std::equal_to<ci::string> > UserListByNick;
-extern CoreExport patricia_tree<User> UserListByUID;
+extern CoreExport patricia_tree<User *, std::equal_to<ci::string> > UserListByNick;
+extern CoreExport patricia_tree<User *> UserListByUID;
class CoreExport ChannelStatus : public Flags<ChannelModeName, CMODE_END * 2>
{