29#ifndef __BASE_CAST_HH__
30#define __BASE_CAST_HH__
43#if defined(GEM5_DEBUG)
47template <
class T,
class U>
59 T ret =
dynamic_cast<T
>(std::forward<U>(ref_or_ptr));
60 if constexpr (std::is_pointer_v<T>) {
72template <
class T,
class U>
81 static_assert(std::is_polymorphic_v<
82 std::remove_pointer_t<
83 std::remove_reference_t<
86 return static_cast<T
>(std::forward<U>(ref_or_ptr));
#define gem5_assert(cond,...)
The assert macro will function like a normal assert, but will use panic instead of straight abort().
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
T safe_cast(U &&ref_or_ptr)