[EMCpp]Item-16 Make Const Member Functions Thread Safe
· β 3 min read
Make const
member functions thread safe unless we’re certain they’ll never be used in a concurrent context.
Make const
member functions thread safe unless we’re certain they’ll never be used in a concurrent context.
constexpr
objects are const
and are initialized with values known during compilation; constexpr
functions can produce copmile-time results when called with arguments whose values are know during compilations.
Most functions are exception-neutral, but for some, such as move operations, swap, memory deallocation functions, and destructors, noexcept
is particularly valuable.
In maximally generic code, prefer non-member versions of begin
, end
, rbegin
, etc., over their member function counterparts.
C++11 gives us a way to make explicit that a derived class function is supposed to override a base class version: override
.