游戏开发论坛

 找回密码
 立即注册
搜索
查看: 1702|回复: 2

vc++,CPoint list operator==

[复制链接]

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
发表于 2007-7-28 00:14:00 | 显示全部楼层 |阅读模式
我定?一??CPoint的list,我?在要判?辔夷壳耙?尤氲狞c,是否重?,我想用find,可是?s出?一些??
我想??一下是否要?承CPoint去改operator==?

std::list<CPoint> m_point_list;
void Func1(CPoint point_cell)
{
std::list <CPoint>::iterator result;
result==std::find(m_point_list.begin(),m_point_list.end(),&point_cell);
}

1>MapGriderView_Draw.cpp
1>d:\program files\microsoft visual studio 8\vc\include\algorithm(40) : error C2678: binary '==' : no operator found which takes a left-hand operand of type 'CPoint' (or there is no acceptable conversion)
1>        could be 'built-in C++ operator==(CPoint *__w64 , CPoint *__w64 )'
1>        d:\program files\microsoft sdks\windows\v6.0\include\guiddef.h(192): or 'int operator ==(const GUID &,const GUID &)' [found using argument-dependent lookup]
1>        d:\program files\microsoft visual studio 8\vc\atlmfc\include\atltypes.h(91): or 'BOOL CPoint:perator ==(POINT) throw() const'
1>        while trying to match the argument list '(CPoint, CPoint *__w64 const )'
1>        d:\program files\microsoft visual studio 8\vc\include\algorithm(74) : see reference to function template instantiation '_InIt std::_Find<std::list<_Ty>::_Iterator<_Secure_validation>,CPoint>(_InIt,_InIt,CPoint &)' being compiled
1>        with
1>        [
1>            _InIt=std::list<CPoint>::_Iterator<false>,
1>            _Ty=CPoint,
1>            _Secure_validation=false
1>        ]
1>        d:\svn\horse racing game\src\mapgrider\mapgriderview_draw.cpp(136) : see reference to function template instantiation '_InIt std::find<std::list<_Ty>::_Iterator<_Secure_validation>,CPoint*__w64 >(_InIt,_InIt,CPoint &)' being compiled
1>        with
1>        [
1>            _InIt=std::list<CPoint>::_Iterator<true>,
1>            _Ty=CPoint,
1>            _Secure_validation=true
1>        ]
1>Build log was saved at "file://d:\SVN\horse racing game\src\MapGrider\Debug\BuildLog.htm"
1>MapGrider - 1 error(s), 0 warning(s)

103

主题

1432

帖子

1458

积分

金牌会员

Rank: 6Rank: 6

积分
1458
QQ
发表于 2007-7-28 11:17:00 | 显示全部楼层

Re:vc++,CPoint list operator==

我怎么觉得你应该写 = 而不是 ==
还有,list<> 有内部的find函数,不用调用公共的find

414

主题

611

帖子

621

积分

高级会员

Rank: 4

积分
621
 楼主| 发表于 2007-8-9 00:37:00 | 显示全部楼层

Re:vc++,CPoint list operator==

3Q 解?Q了
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

作品发布|文章投稿|广告合作|关于本站|游戏开发论坛 ( 闽ICP备17032699号-3 )

GMT+8, 2026-1-25 13:04

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表