@@ -64,6 +64,23 @@ private predicate implicitMoveIsSuppressed(Class c) { |
64 | 64 | /** |
65 | 65 | * Returns the move constructor of the class `c` if it exists, or the copy constructor if it does |
66 | 66 | * not exist and the implicit definition was suppressed by the compiler. |
| 67 | + * |
| 68 | + * For example: |
| 69 | + * ```cpp |
| 70 | + * class OnlyCopyCtor { |
| 71 | + * public: |
| 72 | + * OnlyCopyCtor(const OnlyCopyCtor &) = default; |
| 73 | + * }; |
| 74 | + * |
| 75 | + * static_assert(std::is_copy_constructible_v<OnlyCopyCtor>); // Succeeds |
| 76 | + * static_assert(std::is_move_constructible_v<OnlyCopyCtor>); // Also succeeds |
| 77 | + * ``` |
| 78 | + * |
| 79 | + * Note that without the declared copy constructor, the compiler may define an implicit move |
| 80 | + * constructor. |
| 81 | + * |
| 82 | + * Additionally note that if the move constructor was declared as `= delete;`, then the second |
| 83 | + * assertion in the above example would fail. |
67 | 84 | */ |
68 | 85 | private Constructor getMoveConstructor(Class c) { |
69 | 86 | if |
@@ -76,6 +93,23 @@ private Constructor getMoveConstructor(Class c) { |
76 | 93 | /** |
77 | 94 | * Returns the move assignment operator of the class `c` if it exists, or the copy assignment |
78 | 95 | * operator if it does not exist and the implicit definition was suppressed by the compiler. |
| 96 | + * |
| 97 | + * For example: |
| 98 | + * ```cpp |
| 99 | + * class OnlyCopyAssign { |
| 100 | + * public: |
| 101 | + * OnlyCopyAssign& operator=(const OnlyCopyAssign &) = default; |
| 102 | + * }; |
| 103 | + * |
| 104 | + * static_assert(std::is_copy_assignable_v<OnlyCopyAssign>); // Succeeds |
| 105 | + * static_assert(std::is_move_assignable_v<OnlyCopyAssign>); // Also succeeds |
| 106 | + * ``` |
| 107 | + * |
| 108 | + * Note that without the declared copy assignment operator, the compiler may define an implicit move |
| 109 | + * assignment operator. |
| 110 | + * |
| 111 | + * Additionally note that if the move assignment operator was declared as `= delete;`, then the second |
| 112 | + * assertion in the above example would fail. |
79 | 113 | */ |
80 | 114 | private Operator getMoveAssign(Class c) { |
81 | 115 | if |
|