Skip to content

refactor(refcountptr): Simplify RefCountPtr's Create_NoAddRef, Create_AddRef and add Assign_NoAddRef, Assign_AddRef - #3058

Open
xezon wants to merge 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/simplify-refcountptr
Open

refactor(refcountptr): Simplify RefCountPtr's Create_NoAddRef, Create_AddRef and add Assign_NoAddRef, Assign_AddRef#3058
xezon wants to merge 1 commit into
TheSuperHackers:mainfrom
xezon:xezon/simplify-refcountptr

Conversation

@xezon

@xezon xezon commented Aug 4, 2026

Copy link
Copy Markdown

This change simplifies RefCountPtr's Create_NoAddRef, Create_AddRef and adds Assign_NoAddRef, Assign_AddRef.

Before

RefCountPtr<AIGroup> ptr = RefCountPtr<AIGroup>::Create_NoAddRef(newInstance(AIGroup));

After

RefCountPtr<AIGroup> ptr = Create_NoAddRef(newInstance(AIGroup));

or

RefCountPtr<AIGroup> ptr;
ptr.Assign_NoAddRef(newInstance(AIGroup));

TODO

  • Replicate in Generals

…_AddRef and add Assign_NoAddRef, Assign_AddRef
@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing labels Aug 4, 2026

@Skyaero42 Skyaero42 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

}

template <class T>
RefCountPtr<T> Create_NoAddRef(T *ptr)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should name them

Create_Add_Ref
Create_No_Add_Ref
Assign_Add_Ref
Assign_No_Add_Ref

That would be more in line with the WWVegas naming convention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Minor Severity: Minor < Major < Critical < Blocker Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants