没有任何信息的stl地图 [英] stl map without any information

查看:75
本文介绍了没有任何信息的stl地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有没有办法在没有任何相关信息的情况下使用地图

带钥匙?我不需要用钥匙存储任何信息。


map< char *,>


我不想浪费任何空间并保持信息

我的钥匙只会浪费空间。如果无法做到这一点,那么

我可以添加哪一块最小的垃圾?


map< char *,char> ?


或者在空间方面有更好的东西。


谢谢,

--j



Is there a way to use map without any information associated
with keys? I do not need any information stored with the keys.

map<char * , >

I do not want to waste any space and keeping information with
my key will just waste space. If this can not be done, what is
smallest piece of junk i could add?

map<char *,char> ?

Or is there something better in terms of space.

Thanks,
--j

推荐答案

http://www.sgi.com/tech/stl/hash_set.html

可能这就是你要找的东西: - /

http://www.sgi.com/tech/stl/hash_set.html
probably this is what you are looking for :-/


set< char *>

set< char* >


John写道:
有没有办法使用没有任何相关信息的地图
钥匙?我不需要用钥匙存储任何信息。

map< char *,>

我不想浪费任何空间和保持信息
我的钥匙只会浪费空间。如果无法做到这一点,我可以添加什么最小的垃圾呢?

map< char *,char> ?

或者在空间方面有更好的东西。
Is there a way to use map without any information associated
with keys? I do not need any information stored with the keys.

map<char * , >

I do not want to waste any space and keeping information with
my key will just waste space. If this can not be done, what is
smallest piece of junk i could add?

map<char *,char> ?

Or is there something better in terms of space.




std :: set。如果你要存储指针,你还需要通过

a比较函数来获得有意义的结果 - 否则,它将会b / b
尝试比较指针本身,而不是他们指出的。

结果通常不会有用。


或者,您可能希望存储类似std :: string的内容

已经定义了一个有用的比较函数。 OTOH,这也可能会消耗你想要的空间节省。


-

后来,

杰瑞。


宇宙是自己想象的虚构。



std::set. If you''re going to store pointers, you''ll also need to pass
a comparison function to get meaningful results -- otherwise, it''ll
attempt to compare the pointers themselves, not what they point at. The
result generally won''t be useful.

Alternatively, you might want to store something like std::string that
already defines a useful comparison function. OTOH, this might also
negate the space savings you''re trying for.

--
Later,
Jerry.

The universe is a figment of its own imagination.


这篇关于没有任何信息的stl地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆