zusie has installations of gcc 7, 8, and 9, see command "module avail" and slide 6 of slide set "OpenMP", respectively. Already gcc 7 supports C++11, gcc 8 and 9 support C++17.
There is also an installation of gcc 12 supporting C++-20. However, this requires the use of a Singularity container, which makes it a bit awkward to use, see below. I recommend to stick to gcc versions 7, 8, or 9.
|> superUser@zusie:/tmp # su - risc03
|>
|> risc03@zusie:~> cp /apps/GCC122/ex1_for_each_loop.cpp .
|>
|> risc03@zusie:~> load.ExecEnv::GnuCC_12.2
|> ...
|>
|> Launching a Singularity Container featuring DWARF Vers. 4 Debugging
|> and a GLIBC 2.12+ Linux-x86_64 / ABI execution layer ...
|>
|> #-----------------------------------------------------------------
|> # Commands:
|> # ---------
|> #
|> # gcc -> Gnu C Compiler
|> # g++ -> Gnu C++ Compiler
|> # gfortran -> Gnu Fortran Compiler
|> #
|> # exit -> leave this Ubuntu Xenial Runtime Shell
|> #
|> #-----------------------------------------------------------------
|>
|> risc03@zusie:~$ head -5 ex1_for_each_loop.cpp
|>
|> // siehe: https://www.geeksforgeeks.org/for_each-loop-c/
|>
|> // C++ code to demonstrate the
|> // working of for_each loop
|>
|> risc03@zusie:~$ which g++
|> /apps/GCC122/inst/bin/g++
|>
|> risc03@zusie:~$ g++ -std=c++11 ex1_for_each_loop.cpp -o ex1.exe
|>
|> risc03@zusie:~$ ldd -r ex1.exe
|> linux-vdso.so.1 => (0x00007ffff7fd8000)
|> libstdc++.so.6 => /apps/GCC122/inst/lib64/libstdc++.so.6 (0x00007ffff7bc1000)
|> libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007ffff789f000)
|> libgcc_s.so.1 => /apps/GCC122/inst/lib64/libgcc_s.so.1 (0x00007ffff7682000)
|> libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ffff72b7000)
|> /lib64/ld-linux-x86-64.so.2 (0x00007ffff7fd9000)
|>
|> risc03@zusie:~$ ./ex1.exe
|> Using Arrays:
|> Multiple of 2 of elements are : 2 10 4 8 6
|> Multiple of 3 of elements are : 3 15 6 12 9
|> Using Vectors:
|> Multiple of 2 of elements are : 8 10 16 6 2
|> Multiple of 3 of elements are : 12 15 24 9 3
|>
|> risc03@zusie:~$ exit
|> exit
|>
|> Done with this Singularity Container.
|> Returning to the Command Line Interpreter ...