Modify

Ticket #8384 (closed Feature Requests: invalid)

Opened 13 months ago

Last modified 4 months ago

Make shared_ptr movable

Reported by: viboes Owned by: pdimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.53.0 Severity: Problem
Keywords: Cc:

Description

std::shared_ptr is movable. I would be nice if boost::shared_ptr provides the same interface and use Boost.Move to make the code portable to non c++11 compilers.

shared_ptr(shared_ptr&& r) noexcept;
template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept;
20 Remark: The second constructor shall not participate in overload resolution unless Y* is convertible
to T*.
21 Effects: Move-constructs a shared_ptr instance from r.
22 Postconditions: *this shall contain the old value of r. r shall be empty. r.get() == 0.

...

shared_ptr(shared_ptr&& r) noexcept;
template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept;
20 Remark: The second constructor shall not participate in overload resolution unless Y* is convertible
to T*.
21 Effects: Move-constructs a shared_ptr instance from r.
22 Postconditions: *this shall contain the old value of r. r shall be empty. r.get() == 0.

Attachments

Change History

comment:1 follow-up: ↓ 2 Changed 13 months ago by pdimov

boost::shared_ptr already provides this.

comment:2 in reply to: ↑ 1 Changed 13 months ago by viboes

Replying to pdimov:

boost::shared_ptr already provides this.

I see the C++11 implementation. Is the Boost.Move emulation provided?

comment:3 Changed 13 months ago by pdimov

No. Why do you need it?

comment:4 Changed 13 months ago by viboes

Boost.Thread uses boost::shared_ptr, and the code will be more homogeneous if shared_ptr implemented move semantics using Boost.Move.

comment:5 Changed 13 months ago by pdimov

Can you give me a specific example?

comment:6 Changed 7 months ago by johnmaddock

(In [85987]) Merge accumulated patches from Trunk. Refs #8384, Refs #8855, refs #9107, refs #9109, refs #8333, refs #8621, refs #8732, refs #8733, refs #8837, refs #8940, refs #9042, refs #9087, refs #9104, refs #9126.

comment:7 Changed 4 months ago by pdimov

  • Status changed from new to closed
  • Resolution set to invalid
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.