-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[smart_holder] Auto select return value policy for clif_automatic #4381
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
Changes from 1 commit
5b7d08e
d1b36c9
b7f2e9f
5b7bd24
8f992dd
853c556
74a9e7a
5f310ab
2e3c2b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,9 @@ struct obj { | |
struct nocopy { | ||
std::string mtxt; | ||
nocopy(const std::string &mtxt_) : mtxt(mtxt_) {} | ||
nocopy(const nocopy &) = delete; | ||
nocopy(nocopy &&other) { mtxt = other.mtxt + "_MvCtor"; } | ||
nocopy &operator=(const nocopy &) = delete; | ||
nocopy &operator=(nocopy &&other) { | ||
mtxt = other.mtxt + "_MvCtor"; | ||
return *this; | ||
|
@@ -51,9 +53,13 @@ const obj &return_const_reference() { | |
return value; | ||
} | ||
|
||
std::shared_ptr<obj> return_shared_pointer() { return std::make_shared<obj>("shared_pointer"); } | ||
std::shared_ptr<obj> return_shared_pointer() { | ||
return std::shared_ptr<obj>(new obj("shared_pointer")); | ||
|
||
} | ||
|
||
std::unique_ptr<obj> return_unique_pointer() { return std::make_unique<obj>("unique_pointer"); } | ||
std::unique_ptr<obj> return_unique_pointer() { | ||
return std::unique_ptr<obj>(new obj("unique_pointer")); | ||
} | ||
|
||
nocopy &return_reference_nocopy() { | ||
static nocopy value("reference_nocopy"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't you still need to delete the copy ctor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing this out. I forgot this. I deleted the copy ctor.