Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#7620 closed Patches (fixed)

Basic rvalue and C++11 support

Reported by: Antony Polukhin Owned by: ebf
Milestone: Boost 1.53.0 Component: variant
Version: Boost 1.52.0 Severity: Optimization
Keywords: Cc: antoshkka@…

Description

This patch adds variant(variant&&), variant& operator=(variant&&) and template <class T> variant& operator=(T&&) functions to Boost.Variant for compilers with rvalue references support (rvalue emulation via Boost.Move is not used for compatability reasons).

template <class T> variant& operator=(T&&) function is enabled only if T&& is a rvalue reference.

Patch is constructded via copying original assign functions and adding move semantics to them. Example: Visitor copy_into was copied as move_into. Copy constructors in internal_visit functions were replaced by move constructors.

If compiler supports rvalue references, std::move is imported to namespace ::boost::detail::variant (this also worked around bug with unqualified call to move() in MSVC2010)

BOOST_NOEXCEPT modifiers added to some methods.

This patch improves performance up to 6 times for some operations. Was tested on GCC-4.6 (with and without c++11 mode) and MSVC2012.

Attachments (3)

rvalue_move.patch (17.5 KB) - added by Antony Polukhin 5 years ago.
rvalue_test.cpp (5.1 KB) - added by Antony Polukhin 5 years ago.
Boost.Test for rvalue support of variant
move_perf.cpp (6.5 KB) - added by Antony Polukhin 5 years ago.
Performance test for new rvalue methods

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by Antony Polukhin

Attachment: rvalue_move.patch added

Changed 5 years ago by Antony Polukhin

Attachment: rvalue_test.cpp added

Boost.Test for rvalue support of variant

Changed 5 years ago by Antony Polukhin

Attachment: move_perf.cpp added

Performance test for new rvalue methods

comment:1 Changed 5 years ago by Antony Polukhin

(In [81293]) Added basic rvalue support and marked some functions with BOOST_NOEXCEPT (#refs #7620)

comment:2 Changed 5 years ago by Antony Polukhin

Resolution: fixed
Status: newclosed

(In [81455]) Merge from trunk: added basic rvalue support and marked some functions with BOOST_NOEXCEPT (fixes #7620)

comment:3 Changed 5 years ago by Antony Polukhin

(In [81456]) Merge from trunk: merge performance tests (refs #7620)

comment:4 Changed 5 years ago by Antony Polukhin

Milestone: To Be DeterminedBoost 1.53.0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain ebf.
The resolution will be deleted.

Add Comment


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

 
Note: See TracTickets for help on using tickets.