// Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors. // All rights reserved. // Code licensed under the BSD License. // http://www.anki3d.org/LICENSE #pragma once #include namespace anki { /// @addtogroup util_private /// @{ template struct ExtractType { using Type = T; }; template struct ExtractType { using Type = T; }; template struct ExtractType { using Type = T; }; template struct ExtractType { using Type = T; }; template struct ExtractType { using Type = T; }; /// @} /// @addtogroup util_other /// @{ /// Check if a class is of certain type. template inline Bool isa(const TFrom& c) { return TTo::classof(&c); } /// Check if a class is of certain type. template inline Bool isa(TFrom& c) { return TTo::classof(&c); } /// Check if a class is of certain type. template inline Bool isa(const TFrom* c) { return TTo::classof(c); } /// Check if a class is of certain type. template inline Bool isa(TFrom* c) { return TTo::classof(c); } /// Custom dynamic cast. template inline TTo dcast(TFrom& c) { ANKI_ASSERT(isa::Type>(c)); return static_cast(c); } /// Custom dynamic cast. template inline TTo dcast(TFrom* c) { ANKI_ASSERT(isa::Type>(c)); return static_cast(c); } /// @} } // end namespace anki