网站首页 站内搜索

搜索结果

查询Tags标签: std,共有 1098条记录
  • c++字符串操作

    1. string转map 主要用到 std::getline() 和 std::ws #include <map> #include <string> #include <sstream> #include <iostream>std::map<std::string, std::string> mappify1(std::string const& s) {std::map<std::string, std:…

    2021/8/28 22:36:07 人评论 次浏览
  • C++移动操作,RVO和NRVO

    本文讨论了何时C++会自动进行移动操作,并且说明了复制消除,RVO和NRVO优化。 移动操作主要参考了cppreference 的这个说明, 优化部分的主要的参考来自于stack overflow 的这篇文章。 移动操作 移动操作有关的函数 和移动操作相关的类函数有两个: 移动构造函数: A(A&…

    2021/8/28 22:06:08 人评论 次浏览
  • C++移动操作,RVO和NRVO

    本文讨论了何时C++会自动进行移动操作,并且说明了复制消除,RVO和NRVO优化。 移动操作主要参考了cppreference 的这个说明, 优化部分的主要的参考来自于stack overflow 的这篇文章。 移动操作 移动操作有关的函数 和移动操作相关的类函数有两个: 移动构造函数: A(A&…

    2021/8/28 22:06:08 人评论 次浏览
  • C++使用Jsoncpp源码

    1、下载jsoncpp源码 https://github.com/open-source-parsers/jsoncpp 要注意版本 2、解压 3、使用python生成直接使用的源码 使用python执行脚本 4、生成dist文件夹 这就是可直接使用的源码 5、使用Qt新建工程,加入文件夹路径 6、添加头文件#include "jsoncpp.cpp&…

    2021/8/27 17:36:11 人评论 次浏览
  • C++使用Jsoncpp源码

    1、下载jsoncpp源码 https://github.com/open-source-parsers/jsoncpp 要注意版本 2、解压 3、使用python生成直接使用的源码 使用python执行脚本 4、生成dist文件夹 这就是可直接使用的源码 5、使用Qt新建工程,加入文件夹路径 6、添加头文件#include "jsoncpp.cpp&…

    2021/8/27 17:36:11 人评论 次浏览
  • C++ 踩坑记录:不能使用sort()函数对unordered_map哈希表进行排序

    今天写的以下代码: class Solution { public:static bool cmp(pair<string,int> a, pair<string,int> b){if (a.second==b.second){return a.first<b.first;}else return a.second>b.second;}vector<string> topKFrequent(vector<string>…

    2021/8/25 17:07:49 人评论 次浏览
  • C++ 踩坑记录:不能使用sort()函数对unordered_map哈希表进行排序

    今天写的以下代码: class Solution { public:static bool cmp(pair<string,int> a, pair<string,int> b){if (a.second==b.second){return a.first<b.first;}else return a.second>b.second;}vector<string> topKFrequent(vector<string>…

    2021/8/25 17:07:49 人评论 次浏览
  • 【C++ Primer Plus 编程练习】——第2章

    1 void ch2_1() {2 using namespace std;3 cout << "xxxxxxxx" << endl;4 }5 6 void ch2_2() {7 using namespace std;8 double num;9 cout << "please input a distance in long: "; 10 cin >> num…

    2021/8/24 20:07:50 人评论 次浏览
  • 【C++ Primer Plus 编程练习】——第2章

    1 void ch2_1() {2 using namespace std;3 cout << "xxxxxxxx" << endl;4 }5 6 void ch2_2() {7 using namespace std;8 double num;9 cout << "please input a distance in long: "; 10 cin >> num…

    2021/8/24 20:07:50 人评论 次浏览
  • C++11 make_shared

    make_shared的使用 C++11 中引入了智能指针, 同时还有一个模板函数 std::make_shared 可以返回一个指定类型的 std::shared_ptrshared_ptr<string> p1 = make_shared<string>(10, 9); shared_ptr<string> p2 = make_shared<string>("hello&…

    2021/8/23 20:06:02 人评论 次浏览
  • C++11 make_shared

    make_shared的使用 C++11 中引入了智能指针, 同时还有一个模板函数 std::make_shared 可以返回一个指定类型的 std::shared_ptrshared_ptr<string> p1 = make_shared<string>(10, 9); shared_ptr<string> p2 = make_shared<string>("hello&…

    2021/8/23 20:06:02 人评论 次浏览
  • c++文件指针Demo代码

    #include <iostream> #include <string> #include <vector>int main(){std::string infile = "./infile.txt";std::ifstream in(infile.c_str()); // 将string对象转为char*std::vector<long int> splitlist; // 存储分隔符位置splitch…

    2021/8/23 17:05:53 人评论 次浏览
  • c++文件指针Demo代码

    #include <iostream> #include <string> #include <vector>int main(){std::string infile = "./infile.txt";std::ifstream in(infile.c_str()); // 将string对象转为char*std::vector<long int> splitlist; // 存储分隔符位置splitch…

    2021/8/23 17:05:53 人评论 次浏览
  • C++ std::move

    在C++11中,标准库在<utility>中提供了一个有用的函数std::move,std::move并不能移动任何东西,它唯一的功能是将一个左值强制转化为右值引用,继而可以通过右值引用使用该值,以用于移动语义。从实现上讲,std::move基本等同于一个类型转换:static_cast<T&…

    2021/8/22 20:06:17 人评论 次浏览
  • C++ std::move

    在C++11中,标准库在<utility>中提供了一个有用的函数std::move,std::move并不能移动任何东西,它唯一的功能是将一个左值强制转化为右值引用,继而可以通过右值引用使用该值,以用于移动语义。从实现上讲,std::move基本等同于一个类型转换:static_cast<T&…

    2021/8/22 20:06:17 人评论 次浏览
扫一扫关注最新编程教程