]> git.proxmox.com Git - ceph.git/blame - ceph/src/rocksdb/util/set_comparator.h
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / rocksdb / util / set_comparator.h
CommitLineData
11fdf7f2
TL
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
6#pragma once
7
1e59de90
TL
8#include "rocksdb/comparator.h"
9
f67539c2 10namespace ROCKSDB_NAMESPACE {
11fdf7f2
TL
11// A comparator to be used in std::set
12struct SetComparator {
13 explicit SetComparator() : user_comparator_(BytewiseComparator()) {}
14 explicit SetComparator(const Comparator* user_comparator)
15 : user_comparator_(user_comparator ? user_comparator
16 : BytewiseComparator()) {}
17 bool operator()(const Slice& lhs, const Slice& rhs) const {
18 return user_comparator_->Compare(lhs, rhs) < 0;
19 }
20
21 private:
22 const Comparator* user_comparator_;
23};
f67539c2 24} // namespace ROCKSDB_NAMESPACE