meta: drop meta op cfind, use unused param value to pass constness around
This commit is contained in:
@@ -167,15 +167,15 @@ struct basic_meta_associative_container_traits {
|
||||
break;
|
||||
case operation::find:
|
||||
if(key->allow_cast<const typename Type::key_type &>()) {
|
||||
if(value) {
|
||||
*it = iterator{ctx, std::bool_constant<key_only>{}, const_cast<Type *>(cont)->find(key->cast<const typename Type::key_type &>())};
|
||||
} else {
|
||||
*it = iterator{ctx, std::bool_constant<key_only>{}, cont->find(key->cast<const typename Type::key_type &>())};
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case operation::cfind:
|
||||
if(key->allow_cast<const typename Type::key_type &>()) {
|
||||
*it = iterator{ctx, std::bool_constant<key_only>{}, cont->find(key->cast<const typename Type::key_type &>())};
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,7 @@ enum class meta_associative_container_operation {
|
||||
cend,
|
||||
insert,
|
||||
erase,
|
||||
find,
|
||||
cfind
|
||||
find
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
@@ -2043,7 +2042,7 @@ inline meta_associative_container::size_type meta_associative_container::erase(m
|
||||
*/
|
||||
[[nodiscard]] inline meta_associative_container::iterator meta_associative_container::find(meta_any key) {
|
||||
iterator it{};
|
||||
vtable(storage.policy() == any_policy::cref ? operation::cfind : operation::find, *ctx, std::as_const(storage).data(), &key, nullptr, &it);
|
||||
vtable(operation::find, *ctx, std::as_const(storage).data(), &key, storage.policy() == any_policy::cref ? nullptr : this, &it);
|
||||
return it;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user