本文整理汇总了C++中MemberList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ MemberList::push_back方法的具体用法?C++ MemberList::push_back怎么用?C++ MemberList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemberList
的用法示例。
在下文中一共展示了MemberList::push_back方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MemberToQMemberList
MemberList GroupControler::MemberToQMemberList(std::vector<std::shared_ptr<service::User> > members)
{
MemberList memberList;
for(auto i: members){
if(i == NULL){
continue;
}
Member member;
std::shared_ptr<service::Member> mem = std::dynamic_pointer_cast<service::Member>(i);
if(mem == NULL){
continue;
}
member.avatar=QString::fromStdString(mem->avatar);
if(mem->gender==1){
member.gender="男";
}
else if(mem->gender==2){
member.gender="女";
}
else{
member.gender="保密";
}
member.groupid=QString::number(mem->groupid);
member.id=QString::number(mem->id);
member.member_type=QString::number(mem->member_type);
member.name=QString::fromStdString(mem->name);
member.remark=QString::fromStdString(mem->remark);
if(member.remark=="#"){
member.remark=member.name;
}
std::string str="";
char c=mem->team;
char sz[5] = {c};
str=sz;
if(str.length()>0){
if(str[0]<'A'||str[0]>'Z'){
str[0]='#';
}
}
member.team=QString::fromStdString(str);
if(mem->thumb_avatar!=""){
member.thumbAvatar="/data/data/com.vrv.linkDood/public/head/"+QString::fromStdString(mem->thumb_avatar);
}
memberList.push_back(member);
}
return memberList;
}
示例2: main
int main()
{
typedef std::vector<MyClass>::iterator VectIt;
typedef std::vector<MyClass>::reverse_iterator VectRit;
//Create several MyClass objects, each one with a different value
std::vector<MyClass> values;
for(int i = 0; i < 100; ++i) values.push_back(MyClass(i));
BaseList baselist;
MemberList memberlist;
//Now insert them in the reverse order in the base hook list
for(VectIt it(values.begin()), itend(values.end())
; it != itend ; ++it){
baselist.push_front(*it);
}
//Now insert them in the same order as in vector in the member hook list
for(VectIt it(values.begin()), itend(values.end()); it != itend; ++it)
memberlist.push_back(*it);
//Now test lists
{
BaseList::reverse_iterator rbit(baselist.rbegin()), rbitend(baselist.rend());
MemberList::iterator mit(memberlist.begin()), mitend(memberlist.end());
VectIt it(values.begin()), itend(values.end());
//Test the objects inserted in the base hook list
for(; it != itend; ++it, ++rbit)
if(&*rbit != &*it) return 1;
//Test the objects inserted in the member hook list
for(it = values.begin(); it != itend; ++it, ++mit)
if(&*mit != &*it) return 1;
}
return 0;
}