Modify

Opened 9 years ago

Last modified 7 years ago

#2312 new Patches

intrusive_ptr::operator= should have by-value argument

Reported by: Niels Dekker Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.36.0 Severity: Optimization
Keywords: Cc: Niels Dekker

Description

When a copy assignment operator is implemented simply by doing copy-and-swap, it should pass its argument by value, instead of doing the copy inside the body of the function, to allow the compiler to do copy elision. As was discussed at the Boost developer mailing list, Improving the assignment operators of various Boost types.

So please consider the attached patch.

Attachments (2)

intrusive_ptr_assignment.patch (416 bytes) - added by Niels Dekker 9 years ago.
intrusive_ptr.ass.value.patch (1.2 KB) - added by Georg Sauthoff <gsauthof@…> 8 years ago.

Download all attachments as: .zip

Change History (7)

Changed 9 years ago by Niels Dekker

comment:1 Changed 9 years ago by Peter Dimov

Component: Nonesmart_ptr
Owner: set to Peter Dimov
Severity: ProblemOptimization
Status: newassigned
Type: BugsPatches

comment:2 Changed 9 years ago by Peter Dimov

This ticket depends on #2314.

Changing the assignment operator as suggested also allows us to eliminate the converting assignment.

comment:3 Changed 9 years ago by Peter Dimov

Milestone: Boost 1.37.0To Be Determined

comment:4 Changed 8 years ago by Georg Sauthoff <gsauthof@…>

I updated #2314 and attach a new trivial patch which includes elimination of the converting assignments.

Best regards

Changed 8 years ago by Georg Sauthoff <gsauthof@…>

comment:5 Changed 7 years ago by Peter Dimov

Status: assignednew

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Peter Dimov.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.