Wednesday, February 05, 2020

CPP: Basic usage of std::map

Very basic usage of C++ STL std::map
#include<iostream>
#include<map>
int main()
{
std::map<char, int> map_test {{'a',1},{'b',2},{'c',3},{'d',4},{'e',5}};
for(std::pair<char, int> element : map_test) {
std::cout << element.first << ":" << element.second << std::endl;
}
return 0;
}
view raw stdmap.cpp hosted with ❤ by GitHub


To build:
$: clang++ stdmap.cpp

Run it:
$: ./a.out

No comments:

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04

Configuring TUN/TAP virtual network interface for use with QEMU on Xubuntu 24.04 I am planning to run qemu-system-ppc to play around QEMU ...