File tree 1 file changed +16
-13
lines changed
1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,22 @@ class CopyOnWrite final {
39
39
// Write helpers to access the target data structure.
40
40
template <typename T>
41
41
class ThreadsafeCopyOnWrite final {
42
+ private:
43
+ // Define this early since some of the public members depend on it
44
+ // and some compilers need it to be defined first in that case.
45
+ struct Impl {
46
+ explicit Impl (const T& data) : data(data) {}
47
+ explicit Impl (T&& data) : data(std::move(data)) {}
48
+
49
+ Impl (const Impl& other);
50
+ Impl& operator =(const Impl& other) = delete ;
51
+ Impl (Impl&& other) = delete ;
52
+ Impl& operator =(Impl&& other) = delete ;
53
+
54
+ RwLock mutex;
55
+ T data;
56
+ };
57
+
42
58
public:
43
59
template <typename ... Args>
44
60
ThreadsafeCopyOnWrite (Args&&... args)
@@ -79,19 +95,6 @@ class ThreadsafeCopyOnWrite final {
79
95
Write write () { return Write (this ); }
80
96
81
97
private:
82
- struct Impl {
83
- explicit Impl (const T& data) : data(data) {}
84
- explicit Impl (T&& data) : data(std::move(data)) {}
85
-
86
- Impl (const Impl& other);
87
- Impl& operator =(const Impl& other) = delete ;
88
- Impl (Impl&& other) = delete ;
89
- Impl& operator =(Impl&& other) = delete ;
90
-
91
- RwLock mutex;
92
- T data;
93
- };
94
-
95
98
CopyOnWrite<Impl> impl_;
96
99
};
97
100
You can’t perform that action at this time.
0 commit comments