TODO: Convert Menu Components to Smart Pointers #20

Closed
opened 2023-10-22 23:20:18 -05:00 by AMay · 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.
AMay added the major label 2023-10-22 23:20:18 -05:00
AMay added the wontfix label 2024-01-08 11:47:26 -06:00
AMay closed this issue 2024-01-08 11:47:30 -06:00
AMay 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.
AMay reopened this issue 2024-01-15 17:57:03 -06:00
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; } ```
AMay closed this issue 2024-01-16 17:17:51 -06:00
AMay reopened this issue 2024-01-16 17:30:45 -06:00
Author
Owner

Resolved in pull request #30.

Resolved in pull request #30.
AMay closed this issue 2024-01-16 17:31:35 -06:00
AMay added the enhancement label 2024-01-16 17:31:40 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: AMay/AdventuresInLestoria#20