没有优先队列的dijkstra不算真的dijkstra

所以我又回来补常识了

<1>priority_queue::emplace

<7>priority_queue::top

 // priority_queue::emplace
#include <iostream> // std::cout
#include <queue> // std::priority_queue
#include <string> // std::string int main ()
{
std::priority_queue<std::string> mypq; mypq.emplace("orange");
mypq.emplace("strawberry");
mypq.emplace("apple");
mypq.emplace("pear"); std::cout << "mypq contains:";
while (!mypq.empty())
{
std::cout << ' ' << mypq.top();
mypq.pop();
}
std::cout << '\n'; return ;
}
//Ooutput:mypq contains: strawberry pear orange apple

<2>priority_queue::empty

<3>priority_queue::pop

<4>priority_queue::push

 // priority_queue::push/pop
#include <iostream> // std::cout
#include <queue> // std::priority_queue int main ()
{
std::priority_queue<int> mypq; mypq.push();
mypq.push();
mypq.push();
mypq.push(); std::cout << "Popping out elements...";
while (!mypq.empty())
{
std::cout << ' ' << mypq.top();
mypq.pop();
}
std::cout << '\n'; return ;
}
//Output:Popping out elements... 100 40 30 25

<5>priority_queue::size

<6>priority_queue::swap

 // priority_queue::swap
#include <iostream> // std::cout
#include <queue> // std::priority_queue int main ()
{
std::priority_queue<int> foo,bar;
foo.push (); foo.push(); foo.push();
bar.push (); bar.push(); foo.swap(bar); std::cout << "size of foo: " << foo.size() << '\n';
std::cout << "size of bar: " << bar.size() << '\n'; return ; /*Output:
size of foo: 2
size of bar: 3*/

然后还有个自定义排序来着,到时候再摸。

priority_queue member function的更多相关文章

  1. Thinkphp---------Call to a member function free_result() on a non-object

    1.平时用框架用久了,直接执行原生的sql反而做起来反应迟钝了.今天遇到一个问题,就是直接执行一个添加的sql语句,然后我用了TP框架的M()->query();方法.运行以后,会报Call t ...

  2. :( Call to a member function Table() on a non-object 错误位置

    :( Call to a member function Table() on a non-object 错误位置 $Model不是模板,是你自己先前链接数据库返回的对象...我的是改为$Form

  3. Fatal error: Call to a member function bind_param() on a non-object in

    今天在练习 mysql是出现错误:   Fatal error: Call to a member function bind_param() on a non-object in 解决步骤: 1. ...

  4. ECmall错误:Call to a member function get_users_count() on a non-object

    问题描述: 在后台添加了一个app报错:Call to a member function get_users_count()Fatal error: Call to a member functio ...

  5. magento后台 Fatal error: Call to a member function getId() on a non-object in错误

    后台分类管理出现错误 Fatal error: Call to a member function getId() on a non-object in 在数据库中运行以下sql语句 INSERT I ...

  6. Function语义学之member function

    之前我们讲过编译器会对 nonmember functions 进行怎样的扩充和该写,今天我们来讲一下 member functions 函数调用方式 一.Nonstatic Member Funct ...

  7. Timer.4 - Using a member function as a handler

    In this tutorial we will see how to use a class member function as a callback handler. The program s ...

  8. C++ - 模板类模板成员函数(member function template)隐式处理(implicit)变化

    模板类模板成员函数(member function template)隐式处理(implicit)变化 本文地址: http://blog.csdn.net/caroline_wendy/articl ...

  9. About The Order of The Declarations And Definition When Making a Member Function a Friend.关于使类成员成为另一个类友元函数的声明顺序和定义。

    If only member function clear of WindowMgr is a friend of Screen, there are some points need to note ...

随机推荐

  1. Linux 搭建Mysql主从节点复制

    Linux环境 Centos 6.6 64位 准备两台服务器,搭建一主一从,实现Mysql的读写分离和数据备份 主节点 192.168.43.10 leader 从节点 192.168.43.20 d ...

  2. UCenter网站部署

    搭建LAMP环境部署UCenter LAMP环境: Linux+Apache+mysql+php  用来搭建动态网站或者服务器的开源软件 一.需要安装的软件 [root@tiandong ~]# yu ...

  3. python-pandas-1

    series Series 是pandas两大数据结构中(DataFrame,Series)的一种. 创建Series Series的定义:Series是一种类似于一维数组的对象,它由一组数据(各种N ...

  4. ESPCMS的CSRF添加管理员账号

    ESPCMS的CSRF添加管理员账号 前言 这里开始的思路是先注入进去 然后getshell 但是不关CSRF什么事 换思路 看了一下群消息  大哥发了一个视频  后台名称admin  admin12 ...

  5. webservice代码编写主要包括服务器端发布和客户端调用。

    一.java工程发布,java工程调用   (一).服务器端的编写 1.在eclipse里新建java project工程,创建功能类,通过关键字@webservice(name="newI ...

  6. JVM 监控工具——jstatd

    1. 简介 jstatd是一个rmi的server应用,用于监控jvm的创建和结束,并且提供接口让监控工具(如visualvm)可以远程连接到本机的jvms . 注意是jvms,就是说运行jstatd ...

  7. openMP---第一篇

    openMP 处理for循环 ///////////////////////////////////////////////////////////////////////////////////// ...

  8. 微信小程序之生成二维码

    最近项目中涉及到小程序的生成二维码,很是头疼,经过多次摸索,整理出了自己的一些思想方法,如有不足,欢迎指正. 首先完全按照小程序的结构依次填坑. pages--index.wxml <view ...

  9. ORACLE PSU SPU (2015-11-04)

    Quick Reference to Patch Numbers for Database PSU, SPU(CPU), Bundle Patches and Patchsets (文档 ID 145 ...

  10. 日期格式存入字符类型之后,再转回datetime类型报错

    背景 最近我们迁移了一批服务器,因我们在azure portal 上新开的VM暂时默认只有英文系统,所以我们在开设好的数据库服务器的时候,都会重置数据库字符排序成中文,避免出现中文乱码问题,重置参考路 ...