oneTBB
oneTBB copied to clipboard
Mark relevant functions noexcept
Please mark relevant functions in TBB noexcept
. In particular, consider these members:
- Default constructors, where possible
- Move constructors
- Move assignment
-
swap
members and free functions - Comparison operators
- Hash functions
Having the correct noexcept
specification is important for:
- User's types that use TBB types for members. Default constructors, assignment and comparison functions inherit
noexcept
specification from the corresponding functions of the class' members, so if the TBB type omitsnoexcept
, the downstream type also does. -
swap
is often used in contexts where failure is not an option (e.g. as a means to roll back a failed operation, e.g. to maintain strong guarantee). Thus it is strongly preferred to be a non-throwing operation.swap
is also sometimes used for move implementation. - Having move constructors
noexcept
is important for some containers, e.g.std::vector
, as this allows for a more optimal implementation of some of its operations. - Having comparison and hash functions
noexcept
ensures that lookup functions in associative containers will not throw.
clang-tidy might help to find move constructors and assign operators
@isaevil , FYI