TODO: Convert Menu Components to Smart Pointers #20

Closed
opened 2023-10-22 23:20:18 -05:00 by sigonasr2 · 3 comments
Owner

Because I have way too many raw pointer containers for this.

Because I have way too many raw pointer containers for this.
sigonasr2 added the
major
label 2023-10-22 23:20:18 -05:00
sigonasr2 added the
wontfix
label 2024-01-08 11:47:26 -06:00
sigonasr2 removed the
wontfix
label 2024-01-15 17:56:38 -06:00
Author
Owner

Decided to implement it during the gamepad menu navigation implementation.

Gigantic refactor incoming.

Decided to implement it during the gamepad menu navigation implementation. Gigantic refactor incoming.
Author
Owner

Templated version of custom dynamic pointer casts with potential error handling for wrong type casting:

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;
}
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; } ```
Author
Owner

Resolved in pull request #30.

Resolved in pull request #30.
sigonasr2 added the
enhancement
label 2024-01-16 17:31:40 -06:00
Sign in to join this conversation.
No description provided.