/src/rocksdb/memtable/stl_wrappers.h
Line | Count | Source |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under both the GPLv2 (found in the |
3 | | // COPYING file in the root directory) and Apache 2.0 License |
4 | | // (found in the LICENSE.Apache file in the root directory). |
5 | | #pragma once |
6 | | |
7 | | #include <map> |
8 | | #include <string> |
9 | | |
10 | | #include "rocksdb/comparator.h" |
11 | | #include "rocksdb/memtablerep.h" |
12 | | #include "rocksdb/slice.h" |
13 | | #include "util/coding.h" |
14 | | |
15 | | namespace ROCKSDB_NAMESPACE { |
16 | | namespace stl_wrappers { |
17 | | |
18 | | class Base { |
19 | | protected: |
20 | | const MemTableRep::KeyComparator& compare_; |
21 | | explicit Base(const MemTableRep::KeyComparator& compare) |
22 | 0 | : compare_(compare) {} |
23 | | }; |
24 | | |
25 | | struct Compare : private Base { |
26 | 0 | explicit Compare(const MemTableRep::KeyComparator& compare) : Base(compare) {} |
27 | 0 | inline bool operator()(const char* a, const char* b) const { |
28 | 0 | return compare_(a, b) < 0; |
29 | 0 | } |
30 | | }; |
31 | | |
32 | | } // namespace stl_wrappers |
33 | | } // namespace ROCKSDB_NAMESPACE |