]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | // This source code is licensed under the BSD-style license found in the | |
3 | // LICENSE file in the root directory of this source tree. An additional grant | |
4 | // of patent rights can be found in the PATENTS file in the same directory. | |
5 | #pragma once | |
6 | ||
7 | #include <map> | |
8 | #include <string> | |
9 | ||
10 | #include "rocksdb/comparator.h" | |
11 | #include "rocksdb/slice.h" | |
12 | #include "util/coding.h" | |
13 | #include "util/murmurhash.h" | |
14 | ||
15 | namespace rocksdb { | |
16 | namespace stl_wrappers { | |
17 | ||
18 | struct LessOfComparator { | |
19 | explicit LessOfComparator(const Comparator* c = BytewiseComparator()) | |
20 | : cmp(c) {} | |
21 | ||
22 | bool operator()(const std::string& a, const std::string& b) const { | |
23 | return cmp->Compare(Slice(a), Slice(b)) < 0; | |
24 | } | |
25 | bool operator()(const Slice& a, const Slice& b) const { | |
26 | return cmp->Compare(a, b) < 0; | |
27 | } | |
28 | ||
29 | const Comparator* cmp; | |
30 | }; | |
31 | ||
32 | typedef std::map<std::string, std::string, LessOfComparator> KVMap; | |
33 | } | |
34 | } |