stl_wrappers.h 915 字节
Newer Older
1 2 3 4
//  Copyright (c) 2013, Facebook, Inc.  All rights reserved.
//  This source code is licensed under the BSD-style license found in the
//  LICENSE file in the root directory of this source tree. An additional grant
//  of patent rights can be found in the PATENTS file in the same directory.
5
#pragma once
J
Jim Paton 已提交
6

7 8
#include <map>
#include <string>
J
Jim Paton 已提交
9

10
#include "rocksdb/comparator.h"
11 12
#include "rocksdb/memtablerep.h"
#include "rocksdb/slice.h"
13 14
#include "util/coding.h"
#include "util/murmurhash.h"
J
Jim Paton 已提交
15

16
namespace rocksdb {
J
Jim Paton 已提交
17 18
namespace stl_wrappers {

19 20 21 22 23 24 25 26 27 28 29 30 31 32
class Base {
 protected:
  const MemTableRep::KeyComparator& compare_;
  explicit Base(const MemTableRep::KeyComparator& compare)
      : compare_(compare) {}
};

struct Compare : private Base {
  explicit Compare(const MemTableRep::KeyComparator& compare) : Base(compare) {}
  inline bool operator()(const char* a, const char* b) const {
    return compare_(a, b) < 0;
  }
};

J
Jim Paton 已提交
33 34
}
}