2016-02-10 00:12:00 +01:00
|
|
|
// Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2017-07-16 01:03:42 +02:00
|
|
|
// This source code is licensed under both the GPLv2 (found in the
|
|
|
|
// COPYING file in the root directory) and Apache 2.0 License
|
|
|
|
// (found in the LICENSE.Apache file in the root directory).
|
2013-10-05 07:32:05 +02:00
|
|
|
#pragma once
|
2013-08-23 08:10:02 +02:00
|
|
|
|
2015-09-02 22:58:22 +02:00
|
|
|
#include <map>
|
|
|
|
#include <string>
|
2013-08-23 08:10:02 +02:00
|
|
|
|
2015-09-02 22:58:22 +02:00
|
|
|
#include "rocksdb/comparator.h"
|
2013-08-23 17:38:13 +02:00
|
|
|
#include "rocksdb/slice.h"
|
2015-09-02 22:58:22 +02:00
|
|
|
#include "util/coding.h"
|
2013-08-23 08:10:02 +02:00
|
|
|
|
2020-02-20 21:07:53 +01:00
|
|
|
namespace ROCKSDB_NAMESPACE {
|
2013-08-23 08:10:02 +02:00
|
|
|
namespace stl_wrappers {
|
|
|
|
|
2015-09-02 22:58:22 +02:00
|
|
|
struct LessOfComparator {
|
|
|
|
explicit LessOfComparator(const Comparator* c = BytewiseComparator())
|
|
|
|
: cmp(c) {}
|
|
|
|
|
|
|
|
bool operator()(const std::string& a, const std::string& b) const {
|
|
|
|
return cmp->Compare(Slice(a), Slice(b)) < 0;
|
|
|
|
}
|
2016-11-10 00:00:16 +01:00
|
|
|
bool operator()(const Slice& a, const Slice& b) const {
|
|
|
|
return cmp->Compare(a, b) < 0;
|
|
|
|
}
|
2015-09-02 22:58:22 +02:00
|
|
|
|
|
|
|
const Comparator* cmp;
|
|
|
|
};
|
|
|
|
|
2021-09-07 20:31:12 +02:00
|
|
|
using KVMap = std::map<std::string, std::string, LessOfComparator>;
|
2013-08-23 08:10:02 +02:00
|
|
|
}
|
2020-02-20 21:07:53 +01:00
|
|
|
} // namespace ROCKSDB_NAMESPACE
|