maliput
pointer_cast.h File Reference
#include <memory>
#include <sstream>
#include <stdexcept>
#include "maliput/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

 maliput
 Code in this file is inspired by: https://github.com/RobotLocomotion/drake/blob/master/common/text_logging.h.
 
 maliput::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...