作者s89162504 (路人甲)
看板C_and_CPP
标题[问题] C++ SLT map<struct*,int> 的行为??
时间Mon Jun 1 11:25:54 2020
最近在trace C++的程式码 碰到的问题
想请问 STL的map
如果是把struct或class的指标当作key
让它对应到int
map的行为会是把指标指向的地址当作key
还是会把struct/class里的所有成员变数当作key啊??
感谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 140.112.16.173 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1590981956.A.F06.html
1F:→ loveme00835: 要看你第三个参数型别是怎麽被 instantiate 06/01 11:33
2F:→ steve1012: 你没特别写他要怎麽知道要怎麽用你的member 当key? 06/01 17:03
3F:推 phishingphi: 根据你的标题所述,不考虑explicit specialization 06/01 17:58
4F:→ phishingphi: 的话是用pointer的operator<() 06/01 17:58