Templated version of custom dynamic pointer casts with potential error handling for wrong type casting:
template<typenameT,typenameU>std::shared_ptr<T>DYNAMIC_POINTER_CAST(conststd::shared_ptr<U>&variable){std::shared_ptr<T>newVariable=std::dynamic_pointer_cast<T>(variable);if(!newVariable)std::cout<<"Could not cast!"<<std::endl;returnnewVariable;}template<typenameT,typenameU>std::shared_ptr<T>DYNAMIC_POINTER_CAST(conststd::weak_ptr<U>&variable){std::shared_ptr<T>newVariable=std::dynamic_pointer_cast<T>(variable.lock());if(!newVariable)std::cout<<"Could not cast!"<<std::endl;returnnewVariable;}
Templated version of custom dynamic pointer casts with potential error handling for wrong type casting:
```cpp
template<typename T,typename U>
std::shared_ptr<T>DYNAMIC_POINTER_CAST(const std::shared_ptr<U>&variable){
std::shared_ptr<T> newVariable=std::dynamic_pointer_cast<T>(variable);
if(!newVariable)std::cout<<"Could not cast!"<<std::endl;
return newVariable;
}
template<typename T,typename U>
std::shared_ptr<T>DYNAMIC_POINTER_CAST(const std::weak_ptr<U>&variable){
std::shared_ptr<T> newVariable=std::dynamic_pointer_cast<T>(variable.lock());
if(!newVariable)std::cout<<"Could not cast!"<<std::endl;
return newVariable;
}
```
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Because I have way too many raw pointer containers for this.
Decided to implement it during the gamepad menu navigation implementation.
Gigantic refactor incoming.
Templated version of custom dynamic pointer casts with potential error handling for wrong type casting:
Resolved in pull request #30.