ROSE 0.11.145.192
As.h
1#ifndef ROSE_As_H
2#define ROSE_As_H
3#include <RoseFirst.h>
4
5#include <Sawyer/SharedPointer.h>
6#include <boost/shared_ptr.hpp>
7#include <memory>
8
9namespace Rose {
10
52template<class T, class U>
53std::shared_ptr<T>
54as(const std::shared_ptr<U> &p) {
55 return std::dynamic_pointer_cast<T>(p);
56}
57
58template<class T, class U>
59boost::shared_ptr<T>
60as(const boost::shared_ptr<U> &p) {
61 return boost::dynamic_pointer_cast<T>(p);
62}
63
64template<class T, class U>
67 return p.template dynamicCast<T>();
68}
69
70template<class T, class U>
71T*
72as(U *p) {
73 return dynamic_cast<T*>(p);
74}
77} // namespace
78
79#endif
Reference-counting intrusive smart pointer.
The ROSE library.
std::shared_ptr< T > as(const std::shared_ptr< U > &p)
Dynamic pointer down-cast.
Definition As.h:54