s2geometry icon indicating copy to clipboard operation
s2geometry copied to clipboard

Better to use enum class instead of enum

Open jievince opened this issue 2 years ago • 4 comments

eg. In s2shape_index.h:

enum InitialPosition { BEGIN, END, UNPOSITIONED };

Such an enum name like BEGIN is very common, so it is easy to have the same name with a macro or other enum, which will cause conflict.

jievince avatar Sep 21 '21 13:09 jievince

If changing it to enum class is ok, I will make a PR to fix it.

jievince avatar Sep 22 '21 07:09 jievince

Sure. You can call them kBegin, etc.

jmr avatar Sep 23 '21 14:09 jmr

I mean, send a PR to change it to:

enum class InitialPosition { kBegin, kEnd, kUnpositioned };

jmr avatar Sep 23 '21 14:09 jmr

OK

jievince avatar Sep 23 '21 16:09 jievince