#include #include #include "Student.hpp" template void print(std::unordered_map s) { for(auto it = s.cbegin(); it!=s.cend(); it++) std::cout << it->first << " -> " << it->second << std::endl; } struct HashByAEM { size_t operator()(const Student& st) const { std::hash hash_int; return hash_int(st.getAEM()); } }; struct EqualToByAEM { bool operator() (const Student& st1, const Student& st2) const { return st1.getAEM() == st2.getAEM(); } }; int main(int argc, char *argv[]) { // map students to their address std::unordered_map students; std::pair peter_pan_pair(Student("Peter Pan", 1234), std::string("Wendy House, Neverland")); std::pair mickey_mouse_pair = make_pair(Student("Mickey Mouse", 1235), std::string("Walt Disney World Communications, P.O Box 10040, Lake Buena Vista, Florida 32830-0040 ")); students.insert( peter_pan_pair ); students.insert( mickey_mouse_pair ); students.emplace( Student("Minie Mouse", 1240), std::string("Walt Disney World Communications, P.O Box 10040, Lake Buena Vista, Florida 32830-0040 ")); print(students); return 0; }