Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add createShared() and createUnique() pattern #844

Merged
merged 13 commits into from
Feb 12, 2017
Merged

Add createShared() and createUnique() pattern #844

merged 13 commits into from
Feb 12, 2017

Conversation

jslee02
Copy link
Member

@jslee02 jslee02 commented Feb 7, 2017

This PR adds a set of macros that defines two static functions ( createShared and createUnique) for creating shared and unique instances of the object. Developers must carefully choose which macro should be used depending on two factors: (1) whether the object requires aligned memory allocation and (2) whether the object's constructor is public or protected. Whereas, the users are encouraged to use createShared and createUnique without worrying about those factors if the static creators are defined.

Related issue: #813

Open Decisions

  • Name for shared object creator: create() vs createShared(): We use create and createShared for raw pointer and std::shared_ptr, respectively

This change is Reviewable

@jslee02 jslee02 added this to the DART 6.2.0 milestone Feb 7, 2017
@jslee02 jslee02 merged commit c2386d8 into master Feb 12, 2017
@psigen
Copy link
Collaborator

psigen commented Feb 12, 2017

I like this change! 👍

We should probably consider a followup PR that documents the new macros and static create* functions for future developers.

@jslee02 jslee02 deleted the create branch February 27, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants