diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-03-23 01:34:37 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2012-03-23 01:34:37 +0900 |
| commit | eed804baaa02b4f81a27ba2844868b19992a90a1 (patch) | |
| tree | f6c5741443a979593fe080422ac78ef1b0f699d2 /src/AuthConfigFactory.h | |
| parent | 4acc0f88317287b86c6b89ba5e5262d3ebd30cc9 (diff) | |
Use std::set instead of std::deque if the elements are sorted and
insertions and deletions are frequent.
Diffstat (limited to 'src/AuthConfigFactory.h')
| -rw-r--r-- | src/AuthConfigFactory.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/AuthConfigFactory.h b/src/AuthConfigFactory.h index 8eb70f31..3ef2863d 100644 --- a/src/AuthConfigFactory.h +++ b/src/AuthConfigFactory.h @@ -38,10 +38,11 @@ #include "common.h" #include <string> -#include <deque> +#include <set> #include "SharedHandle.h" #include "SingletonHolder.h" +#include "a2functional.h" namespace aria2 { @@ -83,8 +84,11 @@ public: bool operator<(const BasicCred& cred) const; }; + + typedef std::set<SharedHandle<BasicCred>, + DerefLess<SharedHandle<BasicCred> > > BasicCredSet; private: - std::deque<BasicCred> basicCreds_; + BasicCredSet basicCreds_; public: AuthConfigFactory(); @@ -115,7 +119,7 @@ public: // Find a BasicCred using host, port and path and return the // iterator pointing to it. If not found, then return // basicCreds_.end(). - std::deque<AuthConfigFactory::BasicCred>::iterator + BasicCredSet::iterator findBasicCred (const std::string& host, uint16_t port, @@ -124,7 +128,7 @@ public: // If the same BasicCred is already added, then it is replaced with // given basicCred. Otherwise, insert given basicCred to // basicCreds_. - void updateBasicCred(const BasicCred& basicCred); + void updateBasicCred(const SharedHandle<BasicCred>& basicCred); static const std::string ANONYMOUS; |
