From b1a52d0236d234c944b49d2e6fe3c60c92e15d5c Mon Sep 17 00:00:00 2001 From: joaquintides Date: Sat, 15 Apr 2023 09:51:01 +0200 Subject: [PATCH] explicitly declared guards' copy ctors as it prevents VS from doing spurious copies (!) --- include/boost/unordered/detail/foa/concurrent_table.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/boost/unordered/detail/foa/concurrent_table.hpp b/include/boost/unordered/detail/foa/concurrent_table.hpp index 04168d82..922d81d8 100644 --- a/include/boost/unordered/detail/foa/concurrent_table.hpp +++ b/include/boost/unordered/detail/foa/concurrent_table.hpp @@ -106,6 +106,9 @@ public: shared_lock(Mutex& m_)noexcept:m{m_}{m.lock_shared();} ~shared_lock()noexcept{if(owns)m.unlock_shared();} + /* not used but VS in pre-C++17 mode needs to see it for RVO */ + shared_lock(const shared_lock&); + void lock(){BOOST_ASSERT(!owns);m.lock_shared();owns=true;} void unlock(){BOOST_ASSERT(owns);m.unlock_shared();owns=false;} @@ -125,6 +128,9 @@ public: lock_guard(Mutex& m_)noexcept:m{m_}{m.lock();} ~lock_guard()noexcept{m.unlock();} + /* not used but VS in pre-C++17 mode needs to see it for RVO */ + lock_guard(const lock_guard&); + private: Mutex &m; };