Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Extract index_by to namespace algorithm.

  • Loading branch information...
commit 91ee2f1cb9958906b0f3ab6f82638606575ec050 1 parent 6b7a964
@mschuerig authored
Showing with 2 additions and 15 deletions.
  1. +2 −1  src/transpath.cpp
  2. +0 −14 src/util.h
View
3  src/transpath.cpp
@@ -1,6 +1,7 @@
#include "DirectoryMetadata.h"
#include "TruncatingShortener.h"
+#include "algorithm.h"
#include "util.h"
#include <map>
#include <utility>
@@ -37,7 +38,7 @@ translate( const string& longPath, NameShortener& shortener) {
util::throw_errno("Not a directory", prefixPath, ENOTDIR);
}
- EntryMap entryMap = util::index_by(*dm, &DirectoryMetadata::Entry::longName);
+ EntryMap entryMap = algorithm::index_by(*dm, &DirectoryMetadata::Entry::longName);
EntryMap::const_iterator ep( entryMap.find(part.string()) );
if ( ep != entryMap.end() ) {
View
14 src/util.h
@@ -59,20 +59,6 @@ class CatchAll {
A2 a2_;
};
-
-template<typename T, typename R>
-std::map<R, typename T::value_type>
-index_by(const T& t, R T::value_type::*ptr_to_mem)
-{
- std::map<R, typename T::value_type> idx;
- for ( typename T::const_iterator i = t.begin(), end = t.end();
- i != end;
- ++i ) {
- idx[((*i).*ptr_to_mem)] = *i;
- }
- return idx;
-}
-
} // namespace util
#endif // UTIL_H_INCLUDED_
Please sign in to comment.
Something went wrong with that request. Please try again.