我想创建一个包含复合键的map。例如,我有学生的卷号和他/她正在学习的学期。现在我想创建一个map,以便将rollno和semester一起作为map的键。 最佳答案 与其为键定义您自己的类并且必须定义您自己的比较运算符,因为您只关心卷号和学期,我会使用std::pair。#include#include//Thismapsanstd::pairof(rollnumber,semester)toaStudentRecord.std::map,StudentRecord>studentMap;studentMap.insert(std