Modify

Opened 4 years ago

Closed 4 years ago

#8384 closed Feature Requests (invalid)

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 (0)

Change History (7)

comment:1 follow-up: Changed 4 years ago by pdimov

boost::shared_ptr already provides this.

comment:2 in reply to: ↑ 1 Changed 4 years 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 4 years ago by pdimov

No. Why do you need it?

comment:4 Changed 4 years 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 4 years ago by pdimov

Can you give me a specific example?

comment:6 Changed 4 years 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 years ago by pdimov

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain pdimov.
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.