Drake
Drake C++ Documentation
pointer_cast.h File Reference
#include <memory>
#include <stdexcept>
#include <fmt/format.h>
#include "drake/common/nice_type_name.h"
Include dependency graph for pointer_cast.h:
This graph shows which files directly or indirectly include this file:

Namespaces

 drake
 

Functions

template<class T , class U >
std::unique_ptr< T > static_pointer_cast (std::unique_ptr< U > &&other) noexcept
 Casts the object owned by the std::unique_ptr other from type U to T; no runtime type checking is performed. More...
 
template<class T , class U >
std::unique_ptr< T > dynamic_pointer_cast (std::unique_ptr< U > &&other) noexcept
 Casts the object owned by the std::unique_ptr other from type U to T; if the cast fails, returns nullptr. More...
 
template<class T , class U >
std::unique_ptr< T > dynamic_pointer_cast_or_throw (std::unique_ptr< U > &&other)
 Casts the object owned by the std::unique_ptr other from type U to T; if other is nullptr or the cast fails, throws a std::exception. More...
 
template<class T , class U >
T * dynamic_pointer_cast_or_throw (U *other)
 Casts the pointer other from type U to T using dynamic_cast. More...