common/concepts: Rename IsBaseOf to DerivedFrom

This makes it more inline with its currently unavailable standardized
analogue std::derived_from.

While we're at it, we can also make the template match the requirements
of the standardized variant as well.
This commit is contained in:
Lioncash 2020-08-07 07:55:50 -04:00
parent f5d538f118
commit 8e86fa7e60
3 changed files with 8 additions and 6 deletions

View file

@ -23,10 +23,12 @@ concept IsSTLContainer = requires(T t) {
t.size();
};
// Check if type T is derived from T2
template <typename T, typename T2>
concept IsBaseOf = requires {
std::is_base_of_v<T, T2>;
// TODO: Replace with std::derived_from when the <concepts> header
// is available on all supported platforms.
template <typename Derived, typename Base>
concept DerivedFrom = requires {
std::is_base_of_v<Base, Derived>;
std::is_convertible_v<const volatile Derived*, const volatile Base*>;
};
} // namespace Common