Modify

Opened 17 months ago

#12351 new Patches

boost::make_shared doesn't use constructor forwarding through move emulation

Reported by: me@… Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.59.0 Severity: Problem
Keywords: Cc:

Description

Currently, boost::make_shared doesn't perform constructor forwarding unless C++11 r-value references are supported. This prevents using of MOVABLE_BUT_NOT_COPYABLE types as arguments to constructors.

The Boost.Move documentation describes how to perform (limited) constructor forwarding. It's example is perfectly applicable to boost::make_shared.

The change in boostorg/smart_ptr#24 implements constructor forwarding for make_shared as documented in Boost.Move's documentation.

With this change the difference between the code supporting r-value references but not supporting variadic templates became the type signature and the call to boost::detail::sp_forward and boost::forward. The first difference was eliminated by using the macro BOOST_FWD_REF, the second by using boost::forward in both places, making the two pieces of code textually equal and thus I also removed the duplicate.

Attachments (1)

0001-boost-make_shared-use-Constructor-Forwarding-on-C-03.patch (35.2 KB) - added by me@… 17 months ago.
patch boostorg/smart_ptr#24 adding (partial) constructor forwarding on C++03

Download all attachments as: .zip

Change History (1)

Changed 17 months ago by me@…

patch boostorg/smart_ptr#24 adding (partial) constructor forwarding on C++03

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.