关于vector的问题,可能很简单
我的问题是这样的
if( bNotifyLayout && pTmpRoot )
//pTmpRoot->CheckPageDescs( (SwPageFrm*)pTmpRoot->Lower() ); //原来的代码
std::vector<SwRootFrm*> aAllLayout = GetAllLayouts();//修改后的代码
std::for_each( aAllLayout.begin(), aAllLayout.end(), allCheckPageDescs );//修改后的代码
解释一下:
由于原来的代码仅仅是对当前的Layout进行操作,而这里是要对容器中的所有layout都进行操作,那么我想到了for_each函数,并且定义了GetAllLayout函数
函数定义没有问题。
但是现在编译报错,
error C2440: 'initializing'
: cannot convert from 'SwRootFrm *' to '_STL::vector<_Tp> &'
with
[
_Tp=SwRootFrm
]
请问大侠们这是什么问题?是不是我在使用的时候出什么问题了?
谢谢