mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2025-12-17 20:54:41 +03:00
fix Enum.4
This commit is contained in:
@@ -7656,14 +7656,14 @@ Convenience of use and avoidance of errors.
|
|||||||
|
|
||||||
##### Example
|
##### Example
|
||||||
|
|
||||||
enum Day { mon, tue, wed, thu, fri, sat, sun };
|
enum class Day { mon, tue, wed, thu, fri, sat, sun };
|
||||||
|
|
||||||
Day operator++(Day& d)
|
Day operator++(Day& d)
|
||||||
{
|
{
|
||||||
return d == sun ? mon : Day{++d};
|
return d == Day::sun ? Day::mon : Day{++d};
|
||||||
}
|
}
|
||||||
|
|
||||||
Day today = sat;
|
Day today = Day::sat;
|
||||||
Day tomorrow = ++today;
|
Day tomorrow = ++today;
|
||||||
|
|
||||||
##### Enforcement
|
##### Enforcement
|
||||||
|
|||||||
Reference in New Issue
Block a user