2005年11月9日

stl::set 的一个缺陷

摘要: stl::set 的一个缺陷什么都好,就一点不好:不能仅仅通过 key去查找元素。如 :#include struct my_struct{ int key; int value1; int value2;//……..…. //…… explicit my_struct(int key_) // explicit 禁止将 int 悄悄转化为 my_struct : key( key_) { //.... } struct compare { bool operator()(const my_struct& l, const my_struct& r) const { retur 阅读全文

posted @ 2005-11-09 23:09 能发波 阅读(145) 评论(0) 推荐(0)

导航