VR-Forces Developer's Guide
Home
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
vrfutil
polymorphic_pointer_downcast.h
Go to the documentation of this file.
1
5
#pragma once
6
9
template
<
typename
Derived,
typename
Base>
10
inline
std::shared_ptr<Derived>
polymorphic_pointer_downcast
(
11
const
std::shared_ptr<Base>& b)
12
{
13
#ifdef _DEBUG
14
std::shared_ptr<Derived> d(std::dynamic_pointer_cast<Derived>(b));
15
assert(d);
16
return
d;
17
#else
18
return
std::static_pointer_cast<Derived>(b);
19
#endif
20
}
polymorphic_pointer_downcast
std::shared_ptr< Derived > polymorphic_pointer_downcast(const std::shared_ptr< Base > &b)
works like boost::polymorphic_downcast with std::shared_ptr use when a cast should always work but yo...
Definition:
polymorphic_pointer_downcast.h:10
Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (
www.mak.com
)