group: common base class for group handlers

This commit is contained in:
Michele Caini
2023-03-14 11:11:22 +01:00
parent 3fdf4884d8
commit aaeb686ec7
2 changed files with 5 additions and 3 deletions

View File

@@ -90,11 +90,13 @@ template<typename... Lhs, typename... Rhs>
return !(lhs == rhs);
}
struct basic_group_handler {};
template<typename, typename, typename>
class group_handler;
template<typename... Owned, typename... Get, typename... Exclude>
class group_handler<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> {
class group_handler<owned_t<Owned...>, get_t<Get...>, exclude_t<Exclude...>> final: public basic_group_handler {
// nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
static_assert(!std::disjunction_v<std::bool_constant<Owned::traits_type::in_place_delete>...>, "Groups do not support in-place delete");
static_assert(!std::disjunction_v<std::is_const<Owned>..., std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");
@@ -139,7 +141,7 @@ private:
};
template<typename... Get, typename... Exclude>
class group_handler<owned_t<>, get_t<Get...>, exclude_t<Exclude...>> {
class group_handler<owned_t<>, get_t<Get...>, exclude_t<Exclude...>>: public basic_group_handler {
// nasty workaround for an issue with the toolset v141 that doesn't accept a fold expression here
static_assert(!std::disjunction_v<std::is_const<Get>..., std::is_const<Exclude>...>, "Const storage type not allowed");

View File

@@ -248,7 +248,7 @@ class basic_registry {
struct group_data {
std::size_t size;
std::shared_ptr<void> handler;
std::shared_ptr<internal::basic_group_handler> handler;
bool (*owned)(const id_type) noexcept;
bool (*get)(const id_type) noexcept;
bool (*exclude)(const id_type) noexcept;