// map::crbegin/crend
#include <iostream>
#include <map>
int main ()
{
std::map<char,int> mymap;
mymap['b'] = 100;
mymap['a'] = 200;
mymap['c'] = 300;
std::cout << "mymap backwards:";
for (auto rit = mymap.crbegin(); rit != mymap.crend(); ++rit)
std::cout << " [" << rit->first << ':' << rit->second << ']';
std::cout << '\n';
return 0;
}
Codeblocks is just an IDE, helping users to run compiler and debugger commands
-------------- Debug GNU GCC Compiler)---------------
[ 50.0%] g++.exe -Wall -fexceptions -g -std=c++11 main.cpp -o main.o
[100.0%] g++.exe -o 234.exe main.o
-------------- GNU gdb (GDB) 8.1 ------------------------
[debug]Command-line: C:\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet -args R:/www/234/bin/Debug/234.exe
[debug]Working dir : R:\www\234
C:\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet -args R:/www/234/bin/Debug/234.exe
[debug]> set prompt >>>>>>cb_gdb:
[debug]Reading symbols from R:/www/234/bin/Debug/234.exe...done.
[debug](gdb) >>>>>>cb_gdb:
[debug]> show version
[debug]GNU gdb (GDB) 8.1
[debug]>>>>>>cb_gdb:
[debug]> set confirm off
GNU gdb (GDB) 8.1
[debug]>>>>>>cb_gdb:
[debug]> set width 0
[debug]>>>>>>cb_gdb:
[debug]> set height 0
[debug]>>>>>>cb_gdb:
[debug]> set breakpoint pending on
[debug]>>>>>>cb_gdb:
[debug]> set print asm-demangle on
[debug]>>>>>>cb_gdb:
[debug]> set unwindonsignal on
[debug]>>>>>>cb_gdb:
[debug]> set print elements 200
[debug]>>>>>>cb_gdb:
[debug]> set new-console on
[debug]>>>>>>cb_gdb:
[debug]> set disassembly-flavor att
[debug]>>>>>>cb_gdb:
[debug]> catch throw
[debug]Catchpoint 1 (throw)
[debug]>>>>>>cb_gdb:
[debug]> source C:\CodeBlocks\MinGW\etc\gdbinit
[debug]Traceback (most recent call last):
[debug] File "<string>", line 4, in <module>
[debug] File "c:\codeblocks\mingw\share\gdb/python/../../gcc-8.1.0/python/libstdcxx/v6/printers.py", line 1606, in register_libstdcxx_printers
[debug] gdb.printing.register_pretty_printer(obj, libstdcxx_printer)
[debug] File "c:\codeblocks\mingw\share\gdb/python/gdb/printing.py", line 152, in register_pretty_printer
[debug] printer.name)
[debug]RuntimeError: pretty-printer already registered: libstdc++-v6
[debug]C:\CodeBlocks\MinGW\etc\gdbinit:6: Error in sourced command file:
[debug]Error while executing Python code.
[debug]>>>>>>cb_gdb:>>>>>>cb_gdb:
[debug]> directory R:/www/234/
Error while executing Python code.
[debug]Source directories searched: R:/www/234;$cdir;$cwd
[debug]>>>>>>cb_gdb:
[debug]> break "R:/www/234/main.cpp:11"
[debug]Breakpoint 2 at 0x4015a3: file R:\www\234\main.cpp, line 11.
[debug]>>>>>>cb_gdb:
[debug]> run
[debug]Starting program: R:\www\234\bin\Debug\234.exe
PID:2996
[debug][New Thread 2996.0x1308]
[debug]Breakpoint 2, main () at R:\www\234\main.cpp:11
[debug]R:\www\234\main.cpp:11:151:beg:0x4015a3
[debug]>>>>>>cb_gdb:
R:\www\234\main.cpp:11
[debug]> show language
[debug]The current source language is "auto; currently c++".
[debug]>>>>>>cb_gdb:
[debug]> info locals
[debug]mymap = std::map with 2 elements = {[97 'a'] = 200, [98 'b'] = 100}
[debug]>>>>>>cb_gdb:
[debug]> info args
[debug]No arguments.
[debug]>>>>>>cb_gdb: