@@ -36,7 +36,7 @@ namespace mbed {
36
36
*
37
37
* @par Usage
38
38
*
39
- * To prevent generation of copy constructor and copy assignment operator simply
39
+ * To prevent generation of copy constructor and copy assignment operator,
40
40
* inherit privately from the NonCopyable class.
41
41
*
42
42
* @code
@@ -49,8 +49,8 @@ namespace mbed {
49
49
*
50
50
* @par Background information
51
51
*
52
- * Instances of polymorphic classes are not meant to be copied. Unfortunately,
53
- * the C++ standards generates a default copy constructor and copy assignment
52
+ * Instances of polymorphic classes are not meant to be copied. The
53
+ * C++ standards generate a default copy constructor and copy assignment
54
54
* function if these functions have not been defined in the class.
55
55
*
56
56
* Consider the following example:
@@ -79,18 +79,18 @@ namespace mbed {
79
79
* Connection connection = get_connection();
80
80
* @endcode
81
81
*
82
- * There is a subtile bug in this code, the function get_connection returns a
82
+ * There is a subtle bug in this code, the function get_connection returns a
83
83
* reference to a Connection which is captured by value instead of reference.
84
84
*
85
- * When the reference returned by get_connection is copied into connection, the
86
- * vtable and others members defined in Connection are copied but members defined
85
+ * When the reference get_connection returns is copied into connection, the
86
+ * vtable and others members defined in Connection are copied, but members defined
87
87
* in SerialConnection are left apart. This can cause severe crashes or bugs if
88
- * the virtual functions captured uses members not present in the base
89
- * declaration.
88
+ * the virtual functions captured use members not present in the base
89
+ * declaration.
90
90
*
91
91
* To solve that problem, the copy constructor and assignment operator have to
92
- * be declared (but doesn 't need to be defined) in the private section of the
93
- * Connection class:
92
+ * be declared (but don 't need to be defined) in the private section of the
93
+ * Connection class:
94
94
*
95
95
* @code
96
96
* struct Connection {
@@ -100,12 +100,12 @@ namespace mbed {
100
100
* }
101
101
* @endcode
102
102
*
103
- * While manually declaring private copy constructor and assignment functions
104
- * works, it is not ideal as these declarations are usually not immediately
105
- * visible, easy to forget and may be obscure for uninformed programmer.
103
+ * Although manually declaring private copy constructor and assignment functions
104
+ * works, it is not ideal because these declarations are usually easy to forget,
105
+ * not immediately visible and may be obscure for uninformed programmers.
106
106
*
107
- * Using the NonCopyable class reduce the boilerplate required and express
108
- * clearly the intent as class inheritance appears right after the class name
107
+ * Using the NonCopyable class reduces the boilerplate required and expresses
108
+ * the intent because class inheritance appears right after the class name
109
109
* declaration.
110
110
*
111
111
* @code
@@ -118,11 +118,11 @@ namespace mbed {
118
118
* @par Implementation details
119
119
*
120
120
* Using a template type prevents cases where the empty base optimization cannot
121
- * be applied and therefore ensure that the cost of the NonCopyable semantic
121
+ * be applied and therefore ensures that the cost of the NonCopyable semantic
122
122
* sugar is null.
123
123
*
124
124
* As an example, the empty base optimization is prohibited if one of the empty
125
- * base class is also a base type of the first non static data member:
125
+ * base classes is also a base type of the first nonstatic data member:
126
126
*
127
127
* @code
128
128
* struct A { };
@@ -136,11 +136,11 @@ namespace mbed {
136
136
* };
137
137
*
138
138
* // empty base optimization cannot be applied here because A from C and A from
139
- * // B shall have a different address. In that case, with the alignment
139
+ * // B have a different address. In that case, with the alignment
140
140
* // sizeof(C) == 2* sizeof(int)
141
141
* @endcode
142
142
*
143
- * The solution to that problem is to templatize the empty class to makes it
143
+ * The solution to that problem is to templatize the empty class to make it
144
144
* unique to the type it is applied to:
145
145
*
146
146
* @code
@@ -157,10 +157,10 @@ namespace mbed {
157
157
* // kind of A. sizeof(C) == sizeof(B) == sizeof(int).
158
158
* @endcode
159
159
*
160
- * @tparam T The type that should be made non copyable .
160
+ * @tparam T The type that should be made noncopyable .
161
161
*
162
- * @note Compile time errors are disabled if the develop or the release profile
163
- * is used. To override this behavior and force compile time errors in all profile
162
+ * @note Compile time errors are disabled if you use the develop or the release profile.
163
+ * To override this behavior and force compile time errors in all profiles,
164
164
* set the configuration parameter "platform.force-non-copyable-error" to true.
165
165
*/
166
166
template <typename T>
@@ -180,11 +180,11 @@ class NonCopyable {
180
180
/* *
181
181
* NonCopyable copy constructor.
182
182
*
183
- * A compile time warning is issued when this function is used and a runtime
184
- * warning is printed when the copy construction of the non copyable happens.
183
+ * A compile time warning is issued when this function is used, and a runtime
184
+ * warning is printed when the copy construction of the noncopyable happens.
185
185
*
186
186
* If you see this warning, your code is probably doing something unspecified.
187
- * Copy of non copyable resources can lead to resource leak and random error.
187
+ * Copying of noncopyable resources can lead to resource leak and random error.
188
188
*/
189
189
MBED_DEPRECATED (" Invalid copy construction of a NonCopyable resource." )
190
190
NonCopyable(const NonCopyable &)
@@ -195,11 +195,11 @@ class NonCopyable {
195
195
/* *
196
196
* NonCopyable copy assignment operator.
197
197
*
198
- * A compile time warning is issued when this function is used and a runtime
199
- * warning is printed when the copy construction of the non copyable happens.
198
+ * A compile time warning is issued when this function is used, and a runtime
199
+ * warning is printed when the copy construction of the noncopyable happens.
200
200
*
201
201
* If you see this warning, your code is probably doing something unspecified.
202
- * Copy of non copyable resources can lead to resource leak and random error.
202
+ * Copying of noncopyable resources can lead to resource leak and random error.
203
203
*/
204
204
MBED_DEPRECATED (" Invalid copy assignment of a NonCopyable resource." )
205
205
NonCopyable &operator=(const NonCopyable &)
@@ -211,13 +211,13 @@ class NonCopyable {
211
211
#else
212
212
private:
213
213
/* *
214
- * Declare copy constructor as private, any attempt to copy construct
214
+ * Declare copy constructor as private. Any attempt to copy construct
215
215
* a NonCopyable will fail at compile time.
216
216
*/
217
217
NonCopyable (const NonCopyable &);
218
218
219
219
/* *
220
- * Declare copy assignment operator as private, any attempt to copy assign
220
+ * Declare copy assignment operator as private. Any attempt to copy assign
221
221
* a NonCopyable will fail at compile time.
222
222
*/
223
223
NonCopyable &operator =(const NonCopyable &);
0 commit comments