TODO: Convert Menu Components to Smart Pointers #20

Closed
opened 1 year ago 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 1 year ago
sigonasr2 added the
wontfix
label 11 months ago
sigonasr2 closed this issue 11 months ago
sigonasr2 removed the
wontfix
label 11 months ago
Poster
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.
sigonasr2 reopened this issue 11 months ago
Poster
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; } ```
sigonasr2 closed this issue 11 months ago
sigonasr2 reopened this issue 11 months ago
Poster
Owner

Resolved in pull request #30.

Resolved in pull request #30.
sigonasr2 closed this issue 11 months ago
sigonasr2 added the
enhancement
label 11 months ago
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: sigonasr2/AdventuresInLestoria#20
Loading…
There is no content yet.