Opened 14 years ago

Last modified 12 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 14 years ago.
intrusive_ptr.ass.value.patch (1.2 KB ) - added by Georg Sauthoff <gsauthof@…> 13 years ago.

Download all attachments as: .zip

Change History (7)

by niels_dekker, 14 years ago

comment:1 by Peter Dimov, 14 years ago

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

comment:2 by Peter Dimov, 14 years ago

This ticket depends on #2314.

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

comment:3 by Peter Dimov, 14 years ago

Milestone: Boost 1.37.0To Be Determined

comment:4 by Georg Sauthoff <gsauthof@…>, 13 years ago

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

Best regards

by Georg Sauthoff <gsauthof@…>, 13 years ago

comment:5 by Peter Dimov, 12 years ago

Status: assignednew
Note: See TracTickets for help on using tickets.