当前位置: 首页 > news >正文

装修网站合作平台有哪些网站网页设计怎么收费

装修网站合作平台有哪些,网站网页设计怎么收费,wordpress advanced,管理咨询公司收费标准priority_queue是一个拥有权重概念的queue#xff0c;允许底部加入新的元素#xff0c;头部删除旧的元素#xff0c;以及审视元素数值的操作priority_queue带有权重的概念#xff0c;即元素按照权重进行排列#xff0c;而不是按照插入队列的顺序进行排序。要求权值高者在前…priority_queue是一个拥有权重概念的queue允许底部加入新的元素头部删除旧的元素以及审视元素数值的操作priority_queue带有权重的概念即元素按照权重进行排列而不是按照插入队列的顺序进行排序。要求权值高者在前缺省情况下priority_queue使用max_heap完成而max_heap物理层面是基于vector逻辑层面表现像complate binary treemax_tree用于实现priority_queue的按照权值高低自动递增排序的特性priority_queue定义完整列表 priority_queue底层使用vector在加上堆的处理规则priority_queue不被归纳为容器 而是容器适配器 #include iostream #include vector#ifdef __STL_USE_EXCEPTIONS #define __STL_TRY try #define __STL_UNWIND(action) catch(...) { action; throw; } #else #define __STL_TRY #define __STL_UNWIND(action) #endiftemplate class T,class Sequence std::vectorT,class Compare std::lesstypename Sequence::value_type class priority_queue{ public:typedef typename Sequence::valuetype value_type;typedef typename Sequence::size_type size_type;typedef typename Sequence::reference reference;typedef typename Sequence::const_reference const_reference; protected:Sequence c; //底层容器Compare comp; //元素大小的比较标准 public:priority_queue() : c (){}explicit priority_queue(const Compare x) : c() ,comp(x){}//以下使用的make_heap()、push_heap()、pop_heap()都是泛型算法//注意 任意一个构造函数都立刻在底层容器内产生一个implicit representation heap//指代比较器templateclass InputIteratorpriority_queue(InputIterator first, InputIterator last,const Compare x):c(first,last),comp(x){std::make_heap(c.begin(),c.end(),comp);}//没有指代比较器templateclass InputIteratorpriority_queue(InputIterator first, InputIterator last):c(first,last){std::make_heap(c.begin(),c.end(),comp);}bool empty()const{return c.empty();}size_type size() const{return c.size();}const_reference top()const{return c.front();}void push(const value_type x){__STL_TRY{//push_heap 是泛型算法先利用底层的push_back()将新的元素推入末端再重新排列heapc.push_back(x);//push_heap 是泛型算法std::push_heap(c.begin(),c.end(),comp);}__STL_UNWIND(c.clear());}void pop(){__STL_TRY{//pop_heap是泛型算法从heap中取出一个元素并不是整整将这个元素弹出而是重排heap//需要使用底层vector的pop_back()取得被弹出的元素std::pop_heap(c.begin(),c.end(),comp);c.pop_back();}__STL_UNWIND(c.clear());}}; priority_queue没有迭代器 priority_queue的所有元素进出是有规则限制的只有queue的顶端元素(权值最高者)才可以被外界使用priority_queue不提供遍历的功能因此无迭代器 测试用例 #include iostream #include vector#ifdef __STL_USE_EXCEPTIONS #define __STL_TRY try #define __STL_UNWIND(action) catch(...) { action; throw; } #else #define __STL_TRY #define __STL_UNWIND(action) #endiftemplate class T,class Sequence std::vectorT,class Compare std::lesstypename Sequence::value_type class priority_queue{ public:typedef typename Sequence::value_type value_type;typedef typename Sequence::size_type size_type;typedef typename Sequence::reference reference;typedef typename Sequence::const_reference const_reference; protected:Sequence c; //底层容器Compare comp; //元素大小的比较标准 public:priority_queue() : c (){}explicit priority_queue(const Compare x) : c() ,comp(x){}//以下使用的make_heap()、push_heap()、pop_heap()都是泛型算法//注意 任意一个构造函数都立刻在底层容器内产生一个implicit representation heap//指代比较器templateclass InputIteratorpriority_queue(InputIterator first, InputIterator last,const Compare x):c(first,last),comp(x){std::make_heap(c.begin(),c.end(),comp);}//没有指代比较器templateclass InputIteratorpriority_queue(InputIterator first, InputIterator last):c(first,last){std::make_heap(c.begin(),c.end(),comp);}bool empty()const{return c.empty();}size_type size() const{return c.size();}const_reference top()const{return c.front();}void push(const value_type x){__STL_TRY{//push_heap 是泛型算法先利用底层的push_back()将新的元素推入末端再重新排列heapc.push_back(x);//push_heap 是泛型算法std::push_heap(c.begin(),c.end(),comp);}__STL_UNWIND(c.clear());}void pop(){__STL_TRY{//pop_heap是泛型算法从heap中取出一个元素并不是整整将这个元素弹出而是重排heap//需要使用底层vector的pop_back()取得被弹出的元素std::pop_heap(c.begin(),c.end(),comp);c.pop_back();}__STL_UNWIND(c.clear());} };int main(){int ia[9] {0,1,2,3,4,8,9,3,5};priority_queueintiqp(ia,ia9);std::cout iqp.size() std::endl; //9for (int i 0; i iqp.size(); i) {std::cout iqp.top() ; //9 9 9 9 9 9 9 9 9}std::cout std::endl;while(!iqp.empty()){std::cout iqp.top() ; //9 8 5 4 3 3 2 1 0iqp.pop();}std::cout std::endl; } 参考链接 __STL_TRY和__STL_UNWIND这两个宏的意思 - Superpig0501 - 博客园
http://www.zqtcl.cn/news/239818/

相关文章:

  • 为网站的特色功能设计各种模板温州网页模板建站
  • 广州微网站建设企业网站建设网站优化推广
  • 大连模板网建站项目网络的关键路径
  • 迅雷黄冈网站推广软件徐州模板自助建站
  • 怎么做不占CPU的网站修改wordpress的登陆地址
  • 网站制作毕业设计论文软件ui设计培训机构
  • 物业网站模板哪里建设网站
  • 达州城乡建设网站手机网站 方案
  • 平台兼职网站开发许昌做网站优化
  • 婴幼儿用品网站开发意义基因网站开发
  • 自己网站页面设计软件传奇世界游戏官网
  • 淘宝网网站开发部技术部三亚私人高清影院品牌加盟
  • 网站是用什么软件做的山西网络科技有限公司
  • 汕头网站建设开发做购物网站 营业范围是什么
  • 网站建设 企业短视频运营计划书
  • 网站仿静态网站城市分站织梦系统
  • 淄博网站建设高端企业最新商业资讯
  • 百度推广太原网站建设wordpress的页面和首页一样
  • 无为网站定制php网站 mysql数据库配置文件
  • 如何利用div做网站wordpress替换百度站内搜索
  • 大德通网站建设互动营销网站
  • 网站建设与管理实训主要内容响应式网站建设智能优化
  • 佛山市企业网站建设报价网站建
  • 广州网站营销推广设计孝义网站开发
  • 新站网站如何做Seo那个网站点击率高
  • 个体做外贸的网站罗浮视窗网站建设
  • 产品企业网站上海关键词排名优化公司
  • 网站APP推广东莞人才招聘网58
  • 惠州网站建设哪家好建筑网站建设方案
  • 淄博网站制作营销wordpress 轮播图自适应