Skip to content

Commit

Permalink
Use std::is_virtual_base_of if available
Browse files Browse the repository at this point in the history
std::is_virtual_base_of has been added to C++26, so just
wrap our own reimplementation with a feature-testing macro.

Change-Id: I79a28608ed1e97f034f13a66d60bd491c76a9022
Reviewed-by: Fabian Kosmale <[email protected]>
Reviewed-by: Marc Mutz <[email protected]>
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
dangelog committed Aug 16, 2024
1 parent da580a1 commit 35f92cb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/corelib/global/qxptype_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ constexpr inline bool is_detected_v = is_detected<Op, Args...>::value;
// * ignores cv-qualifications;
// * B may be inaccessibile.

#ifdef __cpp_lib_is_virtual_base_of
using std::is_virtual_base_of;
using std::is_virtual_base_of_v;
#else
namespace _detail {
// Check that From* can be converted to To*, ignoring accessibility.
// This can be done using a C cast (see [expr.cast]/4).
Expand Down Expand Up @@ -112,6 +116,7 @@ using is_virtual_base_of = _detail::is_virtual_base_of<std::remove_cv_t<Base>, s

template <typename Base, typename Derived>
constexpr inline bool is_virtual_base_of_v = is_virtual_base_of<Base, Derived>::value;
#endif // __cpp_lib_is_virtual_base_of

} // namespace qxp

Expand Down

0 comments on commit 35f92cb

Please sign in to comment.