example1_basic_template_alias.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <map>
#include <vector>

template<typename T>
using MapOfVectors = std::map<T, std::vector<T>>;

int main() {
    MapOfVectors<int> myMap;

    myMap[1].push_back(10);
    myMap[1].push_back(20);

    for (const auto& item : myMap[1]) {
        std::cout << item << " " << std::endl;
    }

    return 0;
}
Back to template_alias