Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
for.cc
#include <unordered_map> #include <iostream> #define FOREACH_SAFE(container, it) \ for (auto it = (container).begin(), __nit = it; \ (it != (container).end()) && (++__nit, true); it = __nit) #define FOREACH_LBLOB(container, iter) \ FOREACH_SAFE(container, it_layer) \ FOREACH_SAFE(it_layer->second, iter) class A { typedef std::unordered_map<uint32_t, uint32_t> hashmap; std::unordered_map<uint32_t, hashmap> a; public: void init() { hashmap a1, a2; a1[1]=1; a2[2]=2; a[3]=a1; a[4]=a2; } void print() const { FOREACH_LBLOB(a, iter) { std::cout << "key: " << iter->first << std::endl; std::cout << " value: " << iter->second << std::endl; } } }; int main() { A a; a.init(); a.print(); return 0; }
run
|
edit
|
history
|
help
0
Fractional Knapsack
decomposition
Empty C++
typecasting
СПКИ АП КЭП 3
Simple use of function templete and namespace
decode
Graph Theory 2
SIP_parser_with_std_regex_need_help_to_improve_it.cc
ConversionOperator