mirror of
https://github.com/matrix-construct/construct
synced 2025-01-13 08:23:56 +01:00
ircd::db: Make default comparators noexcept.
This commit is contained in:
parent
554090adcc
commit
41db97fec0
2 changed files with 12 additions and 8 deletions
|
@ -46,8 +46,8 @@ struct ircd::db::comparator
|
|||
struct ircd::db::cmp_string_view
|
||||
:db::comparator
|
||||
{
|
||||
static bool less(const string_view &a, const string_view &b);
|
||||
static bool equal(const string_view &a, const string_view &b);
|
||||
static bool less(const string_view &a, const string_view &b) noexcept;
|
||||
static bool equal(const string_view &a, const string_view &b) noexcept;
|
||||
|
||||
cmp_string_view();
|
||||
};
|
||||
|
@ -55,8 +55,8 @@ struct ircd::db::cmp_string_view
|
|||
struct ircd::db::reverse_cmp_string_view
|
||||
:db::comparator
|
||||
{
|
||||
static bool less(const string_view &a, const string_view &b);
|
||||
static bool equal(const string_view &a, const string_view &b);
|
||||
static bool less(const string_view &a, const string_view &b) noexcept;
|
||||
static bool equal(const string_view &a, const string_view &b) noexcept;
|
||||
|
||||
reverse_cmp_string_view();
|
||||
};
|
||||
|
@ -65,13 +65,13 @@ template<class T>
|
|||
struct ircd::db::cmp_integer
|
||||
:db::comparator
|
||||
{
|
||||
static bool less(const string_view &sa, const string_view &sb)
|
||||
static bool less(const string_view &sa, const string_view &sb) noexcept
|
||||
{
|
||||
const byte_view<T> a{sa}, b{sb};
|
||||
return a < b;
|
||||
}
|
||||
|
||||
static bool equal(const string_view &sa, const string_view &sb)
|
||||
static bool equal(const string_view &sa, const string_view &sb) noexcept
|
||||
{
|
||||
const byte_view<T> a{sa}, b{sb};
|
||||
return a == b;
|
||||
|
@ -86,13 +86,13 @@ template<class T>
|
|||
struct ircd::db::reverse_cmp_integer
|
||||
:db::comparator
|
||||
{
|
||||
static bool less(const string_view &sa, const string_view &sb)
|
||||
static bool less(const string_view &sa, const string_view &sb) noexcept
|
||||
{
|
||||
const byte_view<T> a{sa}, b{sb};
|
||||
return a > b;
|
||||
}
|
||||
|
||||
static bool equal(const string_view &sa, const string_view &sb)
|
||||
static bool equal(const string_view &sa, const string_view &sb) noexcept
|
||||
{
|
||||
return cmp_integer<T>::equal(sa, sb);
|
||||
}
|
||||
|
|
|
@ -7731,6 +7731,7 @@ ircd::db::cmp_string_view::cmp_string_view()
|
|||
bool
|
||||
ircd::db::cmp_string_view::less(const string_view &a,
|
||||
const string_view &b)
|
||||
noexcept
|
||||
{
|
||||
return a < b;
|
||||
}
|
||||
|
@ -7738,6 +7739,7 @@ ircd::db::cmp_string_view::less(const string_view &a,
|
|||
bool
|
||||
ircd::db::cmp_string_view::equal(const string_view &a,
|
||||
const string_view &b)
|
||||
noexcept
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
@ -7754,6 +7756,7 @@ ircd::db::reverse_cmp_string_view::reverse_cmp_string_view()
|
|||
bool
|
||||
ircd::db::reverse_cmp_string_view::less(const string_view &a,
|
||||
const string_view &b)
|
||||
noexcept
|
||||
{
|
||||
/// RocksDB sez things will not work correctly unless a shorter string
|
||||
/// result returns less than a longer string even if one intends some
|
||||
|
@ -7770,6 +7773,7 @@ ircd::db::reverse_cmp_string_view::less(const string_view &a,
|
|||
bool
|
||||
ircd::db::reverse_cmp_string_view::equal(const string_view &a,
|
||||
const string_view &b)
|
||||
noexcept
|
||||
{
|
||||
return a == b;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue