Molybden API
Loading...
Searching...
No Matches
is_base_and_derived.hpp
1// Copyright (c) 2000-2024 TeamDev. All rights reserved.
2// TeamDev PROPRIETARY and CONFIDENTIAL.
3// Use is subject to license terms.
4
5#ifndef MOLYBDEN_IS_BASE_AND_DERIVED_HPP
6#define MOLYBDEN_IS_BASE_AND_DERIVED_HPP
7
8#include "molybden/base/internal/nullptr.hpp"
9
10namespace molybden {
11namespace internal {
12
19template <class B, class D>
20class IsBaseAndDerived {
21 public:
25 static constexpr bool Value() { return IsPtrToBase(Nullptr<D>()); }
26
27 private:
28 static constexpr bool IsPtrToBase(B*) { return true; }
29
30 static constexpr bool IsPtrToBase(void*) { return false; }
31};
32
33} // namespace internal
34} // namespace molybden
35
36#endif // MOLYBDEN_IS_BASE_AND_DERIVED_HPP