Skip to content

Commit 2fb583a

Browse files
committed
Fixed friend class std::lock_guard for MSVS higher than 2015 (1900)
1 parent 4cafca6 commit 2fb583a

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

CDS_test/safe_ptr.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ namespace sf {
7373
template<typename some_type> friend struct xlocked_safe_ptr;
7474
template<typename some_type> friend struct slocked_safe_ptr;
7575
template<typename, typename, size_t, size_t> friend class lock_timed_transaction;
76-
#if (_WIN32 && _MSC_VER < 1900)
77-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
76+
#if (_MSC_VER && _MSC_VER == 1900)
77+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
7878
#else
79-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
79+
template<class mutex_type> friend class std::lock_guard; // other compilers
8080
#endif
8181
#ifdef SHARED_MTX
8282
template<typename mutex_type> friend class std::shared_lock; // C++14

Real_app_bench/safe_ptr.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ namespace sf {
7373
template<typename some_type> friend struct xlocked_safe_ptr;
7474
template<typename some_type> friend struct slocked_safe_ptr;
7575
template<typename, typename, size_t, size_t> friend class lock_timed_transaction;
76-
#if (_WIN32 && _MSC_VER < 1900)
77-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
76+
#if (_MSC_VER && _MSC_VER == 1900)
77+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
7878
#else
79-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
79+
template<class mutex_type> friend class std::lock_guard; // other compilers
8080
#endif
8181
#ifdef SHARED_MTX
8282
template<typename mutex_type> friend class std::shared_lock; // C++14

any_object_threadsafe/safe_ptr.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ class safe_ptr {
5151
void unlock() { mtx_ptr->unlock(); }
5252
friend struct link_safe_ptrs;
5353
template<size_t, typename, size_t, size_t> friend class lock_timed_any;
54-
#if (_WIN32 && _MSC_VER < 1900)
55-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
54+
#if (_MSC_VER && _MSC_VER == 1900)
55+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
5656
#else
57-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
57+
template<class mutex_type> friend class std::lock_guard; // other compilers
5858
#endif
5959
public:
6060
template<typename... Args>

bench_contfree/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class safe_ptr {
6666
template<typename some_type> friend struct xlocked_safe_ptr;
6767
template<typename some_type> friend struct slocked_safe_ptr;
6868
template<typename, typename, size_t, size_t> friend class lock_timed_transaction;
69-
#if (_WIN32 && _MSC_VER < 1900)
70-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
69+
#if (_MSC_VER && _MSC_VER == 1900)
70+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
7171
#else
72-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
72+
template<class mutex_type> friend class std::lock_guard; // other compilers
7373
#endif
7474
#ifdef SHARED_MTX
7575
template<typename mutex_type> friend class std::shared_lock; // C++14

benchmark/main.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ class safe_ptr {
6666
template<typename some_type> friend struct xlocked_safe_ptr;
6767
template<typename some_type> friend struct slocked_safe_ptr;
6868
template<typename, typename, size_t, size_t> friend class lock_timed_transaction;
69-
#if (_WIN32 && _MSC_VER < 1900)
70-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
69+
#if (_MSC_VER && _MSC_VER == 1900)
70+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
7171
#else
72-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
72+
template<class mutex_type> friend class std::lock_guard; // other compilers
7373
#endif
7474
#ifdef SHARED_MTX
7575
template<typename mutex_type> friend class std::shared_lock; // C++14

safe_ptr.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,10 @@ namespace sf {
7373
template<typename some_type> friend struct xlocked_safe_ptr;
7474
template<typename some_type> friend struct slocked_safe_ptr;
7575
template<typename, typename, size_t, size_t> friend class lock_timed_transaction;
76-
#if (_WIN32 && _MSC_VER < 1900 || __clang__)
77-
template<class mutex_type> friend class std::lock_guard; // MSVS2013 or Clang 4.0
76+
#if (_MSC_VER && _MSC_VER == 1900)
77+
template<class... mutex_types> friend class std::lock_guard; // MSVS2015
7878
#else
79-
template<class... mutex_types> friend class std::lock_guard; // C++17 or MSVS2015
79+
template<class mutex_type> friend class std::lock_guard; // other compilers
8080
#endif
8181
#ifdef SHARED_MTX
8282
template<typename mutex_type> friend class std::shared_lock; // C++14

0 commit comments

Comments
 (0)