All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
safeTypeCompare.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_BASE_TF_SAFE_TYPE_COMPARE_H
8#define PXR_BASE_TF_SAFE_TYPE_COMPARE_H
9
13
14#include "pxr/pxr.h"
15
16#include <typeinfo>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
23inline bool TfSafeTypeCompare(const std::type_info& t1, const std::type_info& t2) {
24 return t1 == t2;
25}
26
36template <typename TO, typename FROM>
37TO
39 return dynamic_cast<TO>(ptr);
40}
41
42PXR_NAMESPACE_CLOSE_SCOPE
43
44#endif // PXR_BASE_TF_SAFE_TYPE_COMPARE_H
bool TfSafeTypeCompare(const std::type_info &t1, const std::type_info &t2)
Safely compare std::type_info structures.
TO TfSafeDynamic_cast(FROM *ptr)
Safely perform a dynamic cast.