mirror of
https://github.com/isocpp/CppCoreGuidelines.git
synced 2024-03-22 13:30:58 +08:00
fix Enum.4
This commit is contained in:
parent
3ec8cfc5cc
commit
3ca23f1575
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user