[Mac tutorial] Setting up C++ for Competitive Programming

Revision en1, by BunnyWarlock, 2023-12-21 17:51:32
I have done most of my contests using a 2015 MacBook Pro, and my experience, for the most part, was not as enjoyable as when I did contests using my Windows PC. I saw that my Mac compiled using C++98, even though my gcc compiler was up to date, so I could not use stuff like range-based loop, auto, etc in my code. I got used to it, but recently I started looking for a fix again, and luckily I was able to do it.

Installing GCC

First set up homebrew in your mac and install gcc using brew install gcc. To find more details about this step check the links provided at the end. ~~~~~

Using GCC to the fullest
========================
To use features like `<bits/stdc++.h>` and [Policy Based Data Structures](https://mirror.codeforces.com/blog/entry/11080)
Tags mac, gcc, c++20, compiler

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en11 English BunnyWarlock 2023-12-21 19:49:04 1 Tiny change: ' `g++-13 --std=c++20' -> ' `g++-13 -std=c++20'
en10 English BunnyWarlock 2023-12-21 19:48:31 4 Tiny change: ' --std=c++17 <filename' -> ' --std=c++20 <filename'
en9 English BunnyWarlock 2023-12-21 19:47:51 10
en8 English BunnyWarlock 2023-12-21 19:44:22 196 Tiny change: 'en.\n\n3. from this s' -> 'en.\n\n3. From this s' (published)
en7 English BunnyWarlock 2023-12-21 19:32:35 1269 Tiny change: 'oiler>\n\n<spoil' -> 'oiler>\n\n\n<spoil'
en6 English BunnyWarlock 2023-12-21 19:23:50 365 Tiny change: 'o do it.\n[cut]\n\' -> 'o do it.\n\n[cut]\n\'
en5 English BunnyWarlock 2023-12-21 18:37:23 1337
en4 English BunnyWarlock 2023-12-21 18:20:31 610 Tiny change: '/11080).\nFirst se' -> '/11080).\n\nFirst se'
en3 English BunnyWarlock 2023-12-21 18:03:31 364
en2 English BunnyWarlock 2023-12-21 17:55:57 33 Tiny change: '~~\n\n\n\n~~' -> '~~\n\n\n\n\n~~'
en1 English BunnyWarlock 2023-12-21 17:51:32 892 Initial revision (saved to drafts)