432 void RoleExternModel::getShareConfig(SourceList& sourceList, std::vector<UInt16>& packs, ShopModel& shopModel)
433 {
434 std::copy(Packs, Packs + SHARE_PRIZE, std::insert_iterator<std::vector<UInt16> >(packs, packs.begin()));
435 struct Fun {
436 std::vector<std::pair<UInt16, UInt8> > pairs;
437 void operator() (UInt16 type) {
438 pairs.push_back(std::make_pair<UInt16, UInt8>(type, Configuration::PACKS));
439 }
440 };
441 Fun fun();
442 std::for_each(Packs, Packs + SHARE_PRIZE, fun);
443 shopModel shopModel(fun.pairs);
444 shopModel.load(sourceList);
445 }
爲什麼編譯器說:非本地函數調用本地類型
error: non-local function ‘Pet::RoleExternModel::getShareConfig(Pet::SourceList&, std::vector >&, Pet::ShopModel&)::Fun Pet::fun()’ uses local type ‘Pet::RoleExternModel::getShareConfig(Pet::SourceList&, std::vector >&, Pet::ShopModel&)::Fun’
如何使它legel?
我們需要一個完整的自包含測試用例來幫助您。 – zwol 2012-08-13 04:07:51
'有趣的樂趣();'或'有趣的樂趣;',我懷疑! – perilbrain 2012-08-13 04:14:23
Fun fun(); - 一個問題......如果修復不起作用,那麼我們需要看到更多...例如Packs? Packs是什麼類型?我看到'包'.. – dans3itz 2012-08-13 04:16:49