C2143,hash_map [英] C2143, hash_map

查看:91
本文介绍了C2143,hash_map的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello World \ n,


i得到错误C2143(语法错误,在''<''之前缺少'';'')使用

以下代码:


#include< hash_map>


struct eqstr

{

bool operator()(const char * s1,const char * s2)const

{

返回strcmp(s1,s2)== 0;

}

};


typedef hash_map< const char *,int,hash< const char *>,eqstr>几个月;


希望有人可以帮助我!


Tnx,

Florian

解决方案

" Florian Liefers" <再***** @ web.de>写了...

Hello World \ n,

我收到错误C2143(语法错误,在''<''之前缺少'';'')使用
以下代码:

#include< hash_map>



bool operator()(const char * s1,const char * s2)const
{
返回strcmp(s1,s2)== 0;
}
};

typedef hash_map< const char *,int,hash< const char *>,eqstr>几个月;




什么是'hash_map"?你确定它是模板的名称吗?

你确定它不是某种命名空间你忘记了吗?b $ b b?b? />

我在这里表达的疑问和疑问是由于事实

没有标准标题< hash_map>,所以你不能假设

,这里任何人都知道你在说什么。


Victor


" Hello World \ n",

什么是'hash_map"?你确定这是模板的名称吗?
你确定它不在你忘记的某种名称空间吗?

这些问题我在这里表达的疑问是由于没有标准标题< hash_map>这样的事实,所以你不能假设这里有人知道你在说什么。




我在这里找到了hash_map:
http://www.sgi.com/tech/stl/hash_map.html

我可以打开头文件hash_map并在VC.NET中有帮助网站按

按F1。


如果有另一个哈希地图类,请告诉我!那将是非常好的

很棒!!!

Tnx,

Florian

" Florian Liefers" <再***** @ web.de>写道...

Hello World \ n,

什么是'hash_map"?你确定这是模板的名称吗?
你确定它不在你忘记的某种名称空间吗?

这些问题我在这里表达的疑问是由于没有标准标题< hash_map>这样的事实,所以你不能假设这里任何人都知道你在说什么。
我在这里找到了hash_map:
http://www.sgi .com / tech / stl / hash_map.html
我可以打开头文件hash_map,在VC.NET中有一个帮助网站按
按F1。



这一切都很好,但它与标准C ++无关。如果你仔细阅读
,你可以在SGI的网页上看到它说

hash_map是一个扩展,而不是标准C ++的一部分。无论VC ++

告诉你什么,也超出了这个新闻组的范围。两个hash_map实现是否被你的VC ++编译器弄糊涂了?

如果还有另一个哈希映射类请告诉我!那将是非常好的!




可能有。但是你为什么不用''std :: map''呢?它

适用于你需要的东西(可能),这将是热门话题

这里。


Victor


"Hello World\n",

i get error C2143 (Syntaxerror, missing '';'' before ''<'') using the
following code:

#include <hash_map>

struct eqstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) == 0;
}
};

typedef hash_map<const char*, int, hash<const char*>, eqstr> months;

hope anyone can help me!

Tnx,
Florian

解决方案

"Florian Liefers" <re*****@web.de> wrote...

"Hello World\n",

i get error C2143 (Syntaxerror, missing '';'' before ''<'') using the
following code:

#include <hash_map>

struct eqstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) == 0;
}
};

typedef hash_map<const char*, int, hash<const char*>, eqstr> months;



What''s "hash_map"? Are you sure it''s the name of the template?
Are you sure it''s not in some kind of namespace that you forgot
to mention?

The questions and doubts expressed by me here are due to the fact
that there is no standard header <hash_map>, so you cannot assume
that anybody here knows what you''re talking about.

Victor


"Hello World\n",

What''s "hash_map"? Are you sure it''s the name of the template?
Are you sure it''s not in some kind of namespace that you forgot
to mention?

The questions and doubts expressed by me here are due to the fact
that there is no standard header <hash_map>, so you cannot assume
that anybody here knows what you''re talking about.



I found hash_map here:
http://www.sgi.com/tech/stl/hash_map.html
I can open the header file hash_map and in VC.NET there is a help site by
pressing F1.

If there is another hash-map class please tell me! That would be very
nice!!!

Tnx,
Florian


"Florian Liefers" <re*****@web.de> wrote...

"Hello World\n",

What''s "hash_map"? Are you sure it''s the name of the template?
Are you sure it''s not in some kind of namespace that you forgot
to mention?

The questions and doubts expressed by me here are due to the fact
that there is no standard header <hash_map>, so you cannot assume
that anybody here knows what you''re talking about.
I found hash_map here:
http://www.sgi.com/tech/stl/hash_map.html
I can open the header file hash_map and in VC.NET there is a help site by
pressing F1.



That''s all nice, but it has nothing to do with Standard C++. If you
read carefully, you can see that on SGI''s web page it says that the
hash_map is an extension, not part of the standard C++. Whatever VC++
tells you is also beyond the scope of this newsgroup. Could it be
that the two hash_map implementations get confused by your VC++ compiler?
If there is another hash-map class please tell me! That would be very
nice!!!



There probably is. But why don''t you use ''std::map'' instead? It
works fine for what you need (probably), and it would be topical
here.

Victor


这篇关于C2143,hash_map的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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