本文整理汇总了C++中myutil::IntSeq::swap方法的典型用法代码示例。如果您正苦于以下问题:C++ IntSeq::swap方法的具体用法?C++ IntSeq::swap怎么用?C++ IntSeq::swap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类myutil::IntSeq
的用法示例。
在下文中一共展示了IntSeq::swap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle
void ReloadTask::handle(){
MyUtil::IntSeq buddies;
try {
buddies = BuddyByIdCacheAdapter::instance().getFriendListAsc( _id, -1 );
} catch( Ice::Exception e ){
MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception : " << e.what() );
return;
} catch( ... ){
MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception" );
return;
}
multimap<int, int> orderFriend;
try{
Statement sql;
sql << "SELECT guest, UNIX_TIMESTAMP(time) AS time FROM relation_"
<< (_id % 100)
<< " WHERE host="
<< _id;
ostringstream pattern;
pattern << "relation_" << (_id % 100);
QueryRunner("relation_buddycache", CDbRServer, pattern.str()).query(
sql, OrderedListHandler( buddies, orderFriend, "time", "guest" ) );
}catch(std::exception& e){
MCE_WARN( "[ReloadTask] handle " << _id << " std::exception " << e.what() );
return;
}catch(...){
MCE_WARN( "[ReloadTask] handle " << _id << " unknown exception." );
return;
}
int time_now = (int)time(NULL);
MyUtil::IntSeq times;
ostringstream timestr;
for( MyUtil::IntSeq::iterator itB=buddies.begin(); itB!=buddies.end(); ++itB ){
times.push_back( time_now );
timestr << time_now << " ";
}
for (multimap<int, int>::reverse_iterator itMap = orderFriend.rbegin(); itMap
!= orderFriend.rend(); ++itMap ){
buddies.push_back(itMap->second);
times.push_back(itMap->first);
timestr << itMap->first << " ";
}
BuddyByAddTimeDataNPtr obj = new BuddyByAddTimeDataN;
buddies.swap(obj->friends);
times.swap(obj->times);
MCE_INFO("[ReloadTask] id=" << _id << " friends.size()=" << obj->friends.size() << " times=" << timestr.str() );
SetDataHelper::instance().invokeDelay(_id,obj,timestr.str());
}