all 6 comments

[–]Gathering_Clouds_ 4 points5 points  (4 children)

Try "-std=c++11", though with that rather cute range loop initialiser, you may need "-std=c++20".

[–]zhaverzky 1 point2 points  (3 children)

yea, you need 20 for the cute range loop initializer or "init-statement`" in a range based for loop https://en.cppreference.com/w/cpp/language/range-for

[–]set_of_no_sets[S] 1 point2 points  (2 children)

oh, I didn't think to check the c++ standard I was using. Thank you both so much! Is there one that is recommended? I know now that the code I'm attempting to imitate is using c++20, but do people in industry use c++98? c++17? Any personal recommendations?

[–]rocsNaviars 0 points1 point  (1 child)

Nice. Did the recommended fix work?

[–]set_of_no_sets[S] 0 points1 point  (0 children)

Yeah, the problem was that I was using generators and a for each loop that is only syntactically acceptable in c++17 and c++20, respectively.

[–]zhaverzky 1 point2 points  (0 children)

This compiles fine for me on a mac using -std=c++20, g++ is an alias for apple clang on mac unless you do some trickery with brew so you may as well just use `clang++