File tree 1 file changed +10
-9
lines changed
1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change 19
19
#include < iostream>
20
20
#endif
21
21
22
- // 1. The function gets a reference to an array as a parameter
23
- // 2. The return value of the function is the reference to a char array
24
- // 3. The function doesn't have a definition, it is never called
25
- // 4. The reference to an array keeps the size of the array
26
- // 5. sizeof operator returns the size of the char array
22
+ // 1. The function receives a reference to an array as its parameter.
23
+ // 2. It returns a reference to a char array as its output.
24
+ // 3. The function lacks a definition and is never invoked.
25
+ // 4. The reference to the array retains its size information.
26
+ // 5. The ` sizeof` operator correctly returns the size of the char array.
27
27
template <typename T, size_t size>
28
28
char (&arraysize_helper (T (&)[size]))[size];
29
29
30
30
#define ARRAYSIZE (arr ) (sizeof (arraysize_helper(arr)))
31
31
#define ARRAYEND (arr ) ((arr) + ARRAYSIZE(arr))
32
32
33
- // A class to disallow the copy constructor and operator= functions.
34
- // Private copy constructor and copy assignment ensure classes derived from
35
- // class CNonCopyable cannot be copied. Should be used as:
36
- // class CFooBar : CNonCopyable {};
33
+ // A class designed to disable the copy constructor and copy assignment
34
+ // operator. By making the copy constructor and assignment operator private,
35
+ // any class derived from CNonCopyable becomes non-copyable.
36
+ // Usage example:
37
+ // class CFooBar : public CNonCopyable {};
37
38
class CNonCopyable
38
39
{
39
40
protected:
You can’t perform that action at this time.
0 commit comments