/* SPDX-FileCopyrightText: 2021 Volker Krause SPDX-License-Identifier: LGPL-2.0-or-later */ #ifndef MAPENTRY_P_H #define MAPENTRY_P_H #include #include #include #pragma pack(push) #pragma pack(1) template struct MapEntry { KeyType key; uint16_t value; }; template constexpr inline bool operator<(MapEntry lhs, MapEntry rhs) { return lhs.key < rhs.key; } template constexpr inline bool operator<(MapEntry lhs, KeyType rhs) { return lhs.key < rhs; } template constexpr inline bool operator<(KeyType lhs, MapEntry rhs) { return lhs < rhs.key; } template inline constexpr bool isSortedLookupTable(const MapEntry (&map)[N]) { #if __cplusplus > 201703L && defined(__GNUC__) && __GNUC__ > 9 && !defined(__clang__) return std::is_sorted(std::begin(map), std::end(map)); #else (void)map; return true; #endif } #pragma pack(pop) #endif