Skip to content

Commit 1414c19

Browse files
authored
Change T.46 to not require copyability, and to account for traits types (see #2281) (#2320)
* Change T.46 to not require copyability, and to account for traits types (see #2281) Closes #2281 * Update to just remove T.46
1 parent ae99cc6 commit 1414c19

File tree

1 file changed

+2
-32
lines changed

1 file changed

+2
-32
lines changed

CppCoreGuidelines.md

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17075,7 +17075,7 @@ Template interface rule summary:
1707517075
* [T.42: Use template aliases to simplify notation and hide implementation details](#rt-alias)
1707617076
* [T.43: Prefer `using` over `typedef` for defining aliases](#rt-using)
1707717077
* [T.44: Use function templates to deduce class template argument types (where feasible)](#rt-deduce)
17078-
* [T.46: Require template arguments to be at least semiregular](#rt-regular)
17078+
* [T.46: (removed)](#rt-regular)
1707917079
* [T.47: Avoid highly visible unconstrained templates with common names](#rt-visible)
1708017080
* [T.48: If your compiler does not support concepts, fake them with `enable_if`](#rt-concept-def)
1708117081
* [T.49: Where possible, avoid type-erasure](#rt-erasure)
@@ -18111,38 +18111,8 @@ For example:
1811118111

1811218112
Flag uses where an explicitly specialized type exactly matches the types of the arguments used.
1811318113

18114-
### <a name="rt-regular"></a>T.46: Require template arguments to be at least semiregular
18114+
### <a name="rt-regular"></a>T.46: (removed)
1811518115

18116-
##### Reason
18117-
18118-
Readability.
18119-
Preventing surprises and errors.
18120-
Most uses support that anyway.
18121-
18122-
##### Example
18123-
18124-
class X {
18125-
public:
18126-
explicit X(int);
18127-
X(const X&); // copy
18128-
X operator=(const X&);
18129-
X(X&&) noexcept; // move
18130-
X& operator=(X&&) noexcept;
18131-
~X();
18132-
// ... no more constructors ...
18133-
};
18134-
18135-
X x {1}; // fine
18136-
X y = x; // fine
18137-
std::vector<X> v(10); // error: no default constructor
18138-
18139-
##### Note
18140-
18141-
Semiregular requires default constructible.
18142-
18143-
##### Enforcement
18144-
18145-
* Flag types used as template arguments that are not at least semiregular.
1814618116

1814718117
### <a name="rt-visible"></a>T.47: Avoid highly visible unconstrained templates with common names
1814818118

0 commit comments

Comments
 (0)