Opened 10 years ago

Closed 10 years ago

#7523 closed Patches (fixed)

Patch that adds missing BOOST_NOEXCEPT to noexcept functions

Reported by: Antony Polukhin Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost Development Trunk Severity: Optimization
Keywords: Cc: antoshkka@…

Description

This is a trivial patch, that marks function with BOOST_NOEXCEPT if:

  • function is commented as " newer throws" and has no BOOST_ASSERT and has no user specified template class destructor call
  • or function is extremely simple (consist of a few lines of code that are guaranteed not to throw)
  • or function has only a call to noexcept function (like swap(shared_ptr<T>& v1, shared_ptr<T>& v2) { v1.swap(v2);} )

Applying this patch will dramatically increase performance of smart pointers on modern compilers (because of N3050, STL containers can not move smart pointers if move assignment and move constructors are not marked with noexcept). It will also reduce the size of compiled code.

Patch is tested on GCC-4.6 (with and without -std=c++0x flag) and MSVC2012

Attachments (1)

noexcept.patch (25.2 KB ) - added by Antony Polukhin 10 years ago.
Updated noexcept patch for trunk version

Download all attachments as: .zip

Change History (5)

by Antony Polukhin, 10 years ago

Attachment: noexcept.patch added

Updated noexcept patch for trunk version

comment:1 by Antony Polukhin, 10 years ago

Type: Feature RequestsPatches

comment:2 by Peter Dimov, 10 years ago

(In [81368]) Apply BOOST_NOEXCEPT patch. Refs #7523.

comment:3 by Peter Dimov, 10 years ago

(In [81457]) Merged revision(s) 81368, 81399, 81407-81409, 81419, 81430-81431, 81437 from trunk: Apply BOOST_NOEXCEPT patch. Refs #7523. ........ Replace std::forward with detail::sp_forward. ........ Cosmetic changes in make_shared_array.hpp and allocate_shared_array.hpp ........ Documentation of make_shared_array: Minor corrections ........ Make make_shared_array.hpp and allocate_shared_array.hpp consistent with namespace qualification in rest of smart_ptr. ........ Update smart_ptr.htm with link to make_shared_array.htm which lists the many overloads of make_shared and allocate_shared for arrays. ........ Update documentation for make_shared and allocate_shared array forms. ........ Minor corrections in make_shared_array.html documentation. ........ Borland fixes. ........

comment:4 by Peter Dimov, 10 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.