随笔分类 -  c++

摘要:1.字符串原始字面量 R"()";2.nullptr3.constexpr4.auto 修饰的是指针或引用的时候才会保留 const volatile属性5.decltype 1. 宏 __has_include功能是检测到某个文件是否可以在工程中被包含. 注意: 是检测有没有能包含的能力,不代表引 阅读全文
posted @ 2022-07-22 09:09 MoonXu 阅读(32) 评论(0) 推荐(0) 编辑
摘要:拷贝[first,last)到[result_first,result_last),长度为后者的长度 并把[result_first,result_last)排序。原来的[first,last)不变 阅读全文
posted @ 2021-09-03 17:30 MoonXu 阅读(16) 评论(0) 推荐(0) 编辑
摘要:使nth这个元素在[first,last)中按照顺序排列的位置是正确的 阅读全文
posted @ 2021-09-02 17:44 MoonXu 阅读(25) 评论(0) 推荐(0) 编辑
摘要:如果[first,last) 都满足pred(*first)是false,则返回true 阅读全文
posted @ 2021-09-02 17:17 MoonXu 阅读(16) 评论(0) 推荐(0) 编辑
摘要:move [first,last) to result move_backward 从 last-1 从后往前移动到result的前一个(从后往前) 阅读全文
posted @ 2021-09-02 17:08 MoonXu 阅读(28) 评论(0) 推荐(0) 编辑
摘要:返回2个范围内第一对不匹配的迭代器的pair 阅读全文
posted @ 2021-09-02 16:47 MoonXu 阅读(13) 评论(0) 推荐(0) 编辑
摘要:minmax返回a pair,一个最小值的引用,一个最大值的引用 minmax_element返回 a pair, 一个最小值的迭代器,一个最大值的迭代器 min_element返回最小值的迭代器 阅读全文
posted @ 2021-09-02 16:40 MoonXu 阅读(33) 评论(0) 推荐(0) 编辑
摘要:max_element返回的是迭代器 max返回的是引用 阅读全文
posted @ 2021-09-02 16:36 MoonXu 阅读(17) 评论(0) 推荐(0) 编辑
摘要:10 10 10 20 20 20 30 30val=20 lower_bound at position 3 //返回大于等于value的第一个 upper_bound at position 6 //返回大于value的第一个 阅读全文
posted @ 2021-09-02 16:28 MoonXu 阅读(23) 评论(0) 推荐(0) 编辑
摘要:功能:返回已排序的前n个元素的后一个迭代器 partial_sort 部分排序,middle前面的,不包括middle。按升序排序或自定义 阅读全文
posted @ 2021-09-02 15:39 MoonXu 阅读(22) 评论(0) 推荐(0) 编辑
摘要:功能:返回当前排列的前一个排列 4 3 2 1 4 3 1 2 4 2 3 1 4 2 1 3 阅读全文
posted @ 2021-09-02 15:30 MoonXu 阅读(11) 评论(0) 推荐(0) 编辑
摘要:template <class BidirectionalIterator, class UnaryPredicate> BidirectionalIterator partition (BidirectionalIterator first, BidirectionalIterator last, 阅读全文
posted @ 2021-09-02 14:56 MoonXu 阅读(20) 评论(0) 推荐(0) 编辑
摘要:make_heap make_heap()用于把一个可迭代容器变成一个堆,默认是大顶堆 第三个参数默认情况下为less<>(),less<int>()用于生成大顶堆。 greater<>()用于生成小顶堆 头文件#include <functional> #include<iostream>#inc 阅读全文
posted @ 2021-09-01 17:56 MoonXu 阅读(47) 评论(0) 推荐(0) 编辑
摘要:template <class InputIterator, class UnaryPredicate> bool all_of (InputIterator first, InputIterator last, UnaryPredicate pred); template<class InputI 阅读全文
posted @ 2021-08-30 11:37 MoonXu 阅读(26) 评论(0) 推荐(0) 编辑
摘要:https://gcc.gnu.org/wiki/cxx-modules hello.cc module; #include <iostream> #include <string_view> export module hello; export void greeter (std::string 阅读全文
posted @ 2021-08-13 14:24 MoonXu 阅读(206) 评论(0) 推荐(0) 编辑
摘要:类模板 std::unique_lock<std::mutex> loc(lock); 用来管理mutex对象,在局部变量创建的时候上锁,在局部变量销毁的时候解锁。保证同步 阅读全文
posted @ 2021-05-21 18:00 MoonXu 阅读(534) 评论(0) 推荐(0) 编辑
摘要:函数模板 返回参数指向的右值引用 并且它原来的对象会失去它本来的值,变成一个未指定的状态 阅读全文
posted @ 2021-05-21 17:46 MoonXu 阅读(79) 评论(0) 推荐(0) 编辑
摘要:从新的线程中返回数据 std::future类模板,对象内部存储一个将来会被赋值的值,通过成员函数get()获取 get()会阻塞,直到对象被赋值 每个promise对象管理一个future对象,promise通过get_future获取其管理的future对象 将promise对象的指针传递给新线 阅读全文
posted @ 2021-05-19 17:38 MoonXu 阅读(122) 评论(0) 推荐(0) 编辑
摘要:ctrl + z 撤销 Ctrl + 向左箭头 回退 Ctrl + 向右箭头 前进 ALT + 1 显隐工程栏 Ctrl + / 添加或删除注释 Ctrl + Alt + L 格式化代码 Alt + F7 Find Usages Ctrl + R 替换 Ctrl + B 在定义和申明之间跳转 Ctr 阅读全文
posted @ 2020-06-29 13:09 MoonXu 阅读(1535) 评论(0) 推荐(0) 编辑
摘要:#include <winsock2.h> void init_winsock() { WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2,2); err = WSAStartup( wVe 阅读全文
posted @ 2020-06-29 12:13 MoonXu 阅读(179) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示