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 }
为什么编译器说:
错误:非本地函数 'Pet::RoleExternModel::getShareConfig(Pet::SourceList&, std::vector >&, Pet::ShopModel&)::Fun Pet::fun()' 使用本地类型 'Pet::RoleExternModel ::getShareConfig(Pet::SourceList&, std::vector >&, Pet::ShopModel&)::Fun'</p>
如何使其合法化?