当前位置: 首页>>代码示例>>C++>>正文


C++ MemberList::push_back方法代码示例

本文整理汇总了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;
}
开发者ID:MakoVsp,项目名称:Linkdood,代码行数:47,代码来源:groupcontroler.cpp

示例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;
}
开发者ID:WangZhibin,项目名称:ThesisCode,代码行数:39,代码来源:doc_how_to_use.cpp


注:本文中的MemberList::push_back方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。