Bu derleyici hatasını çözmeme yardımcı olabilir misiniz?Derleyici hatası C3493: 'func' varsayılan yakalama modu belirtilmediğinden örtülü olarak yakalanamıyor
template<class T>
static void ComputeGenericDropCount(function<void(Npc *, int)> func)
{
T::ForEach([](T *what) {
Npc *npc = Npc::Find(what->sourceId);
if(npc)
func(npc, what->itemCount); // <<<<<<< ERROR HERE
// Error 1 error C3493: 'func' cannot be implicitly captured because no default capture mode has been specified
});
}
static void PreComputeNStar()
{
// ...
ComputeGenericDropCount<DropSkinningNpcCount>([](Npc *npc, int i) { npc->nSkinned += i; });
ComputeGenericDropCount<DropHerbGatheringNpcCount>([](Npc *npc, int i) { npc->nGathered += i; });
ComputeGenericDropCount<DropMiningNpcCount>([](Npc *npc, int i) { npc->nMined += i; });
}
Neden bana hata verdiğini anlayamıyorum ve nasıl düzeltileceğini bilmiyorum. ComputeGenericDropCount(auto func)
da çalışmıyor.
Sen bulabilir bu ilginç: http://stackoverflow.com/questions/2425277/visual-studio-2010-and-stdfunction –