Timeline for Tic-Tac-Toe in C++11 - follow-up
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 25, 2014 at 18:02 | history | edited | Morwenn | CC BY-SA 3.0 |
added 138 characters in body
|
Nov 25, 2014 at 17:53 | comment | added | MORTAL |
@Morwenn ... sorry,,, i have to tell you that player is unsigned int it works as index in array of enum array<Player, 2> not the enum struct Player: char itself. i was confusing about what you mean until i discovered that you were mistaken about our player lol. i felt guilty about it. sorry for confusion.
|
|
Nov 25, 2014 at 16:33 | comment | added | MORTAL | @Morwenn ... thank you for clarify enum. but i ran it in my code it seems work fine. i will keep your warning in my mind. once again thank you | |
Nov 25, 2014 at 16:26 | comment | added | Morwenn |
@MORTAL That's probably an MSVC extension, using ^= with an enum struct should be a hard error. Anyway, you can still overload operator^= for player or simply use an enum instead of an enum struct even though it lessens type safety.
|
|
Nov 25, 2014 at 14:55 | comment | added | MORTAL | @Edward .. please check my code in gist: gist.github.com/anonymous/e04dff4659fa90f364f0 | |
Nov 25, 2014 at 14:40 | comment | added | MORTAL | @Edward .. even with 'enum struct player: char'. still the code can use 'player ^=1' | |
Nov 25, 2014 at 13:27 | comment | added | Edward |
@Morwenn: What do you think about const char players[3]{ 'X', 'O', '-' }; as an alternative to the enum struct ? That way the code could continue to use player ^= 1; to change players.
|
|
Nov 25, 2014 at 13:10 | comment | added | MORTAL | thanks for your answer. i checked it as answer. but constexpr not recognized in VC++ 2013 which i'm using now. | |
Nov 25, 2014 at 12:50 | vote | accept | MORTAL | ||
Nov 25, 2014 at 11:48 | history | answered | Morwenn | CC BY-SA 3.0 |