随笔分类 -  C++

C++语言
摘要:// Source : https://www.geeksforgeeks.org/bitonic-sort/ /* C++ Program for Bitonic Sort. Note that this program works only when size of input is a pow 阅读全文
posted @ 2024-12-09 16:36 经纬视界 阅读(46) 评论(0) 推荐(0)
摘要:/// c++ 内存文件使用例程class MemoryBuffer : public std::strstreambuf { public: using Base = std::basic_streambuf<char>; using char_type = typename Base::char 阅读全文
posted @ 2023-12-25 09:49 经纬视界 阅读(45) 评论(0) 推荐(0)
摘要:C++ std::is_same_v的实现 声明: template<class _Ty, class _Uty> constexpr bool is_same_v = false 特化版本后,即是同一个类型的实现(同一个变量的版本): template<class _Ty> constexpr b 阅读全文
posted @ 2023-12-22 10:04 经纬视界 阅读(45) 评论(0) 推荐(0)
摘要:C++ 标准17 折叠表达式的学习 源码如下:其中调用了 _Is_any_of_v _EXPORT_STD template <class _Ty> _INLINE_VAR constexpr bool is_integral_v = _Is_any_of_v<remove_cv_t<_Ty>, b 阅读全文
posted @ 2023-12-21 11:00 经纬视界 阅读(233) 评论(0) 推荐(0)
摘要:#include <iostream> #include <filesystem> #include <string> namespace fs = std::filesystem; void demo_status(const fs::path& p, fs::file_status s) { s 阅读全文
posted @ 2023-12-04 13:31 经纬视界 阅读(74) 评论(0) 推荐(0)
摘要:1.path类:文件路径相关操作,如指定的路径是否存在等; 2.directory_entry类:获取文件属性等,如指定文件是否是常规文件,还包括文件大小、文件最后修改时间; 3.directory_iterator类:遍历目录,获取目录文件,不包括子目录,其介绍参见; 4.recursive_di 阅读全文
posted @ 2023-12-04 13:25 经纬视界 阅读(47) 评论(0) 推荐(0)
摘要:#include <iostream> #include <fstream> using namespace std; int main() { ifstream infile; try { infile.open("file.txt"); if (!infile) { throw runtime_ 阅读全文
posted @ 2023-12-04 13:21 经纬视界 阅读(42) 评论(0) 推荐(0)
摘要:#include <iostream> #include <semaphore> #include <thread> using namespace std; std::counting_semaphore<3> csem(0); // semaphore release = condition_v 阅读全文
posted @ 2023-12-01 09:03 经纬视界 阅读(69) 评论(0) 推荐(0)
摘要:#include <iostream> #include <filesystem> namespace fs = std::filesystem; void traverseDirectory(const std::string& path) { for (const auto& entry : f 阅读全文
posted @ 2023-11-30 16:32 经纬视界 阅读(1018) 评论(0) 推荐(0)
摘要:#include <iostream> #include <strstream> using namespace std; int main() { char szBuf[16] = {"hello world!"}; std::strstreambuf memo(szBuf,sizeof(szBu 阅读全文
posted @ 2023-11-30 10:51 经纬视界 阅读(71) 评论(0) 推荐(0)