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

伪装学渣无极网站百度云搜索引擎官方入口

伪装学渣无极网站,百度云搜索引擎官方入口,校园二手交易网站开发,抖音搜索关键词推广C17引入了std::filesystem库(文件系统库, filesystem library)。这里整理下std::filesystem::path的使用。 std::filesystem::path,文件系统路径,提供了对文件系统及其组件(例如路径、常规文件和目录)执行操作的工具。此path类主要用法包括&#x…

      C++17引入了std::filesystem库(文件系统库, filesystem library)。这里整理下std::filesystem::path的使用。
      std::filesystem::path,文件系统路径,提供了对文件系统及其组件(例如路径、常规文件和目录)执行操作的工具。此path类主要用法包括:注意:windows和linux的结果差异:windows上为"\\",而linux上为"/"
      (1).构造函数、operator=、assign:赋值;
      (2).append, operator/=:追加;
      (3).concat, operator+=:连接;
      (4).clear:清除;
      (5).make_preferred:将路径的通用格式视图(generic-format view of the path)中的所有目录分隔符(directory separator)转换为首选目录分隔符,例如,在Windows上,\是首选分隔符,路径foo/bar将被转换为foo\bar;
      (6).remove_filename:删除path中的的文件名;
      (7).replace_filename:将path中的原文件名用另一个文件名替换;
      (8).replace_extension:将path中的原扩展名用另一个扩展名替换;
      (9).swap:交换两个path;
      (10).string:返回path的字符串格式;
      (11).compare:按字典顺序比较两个path;
      (12).root_name, root_directory, root_path:返回path的根名字、根目录、根路径;
      (13).relative_path, parent_path:返回相对根路径的路径、返回父路径的路径;
      (14).filename, extension:返回的文件名、扩展名;
      (15).empty:检查path是否为空;
      (16).has_root_path, has_root_name, has_root_directory, has_relative_path, has_parent_path, has_filename, has_extension:检查root_path、root_name、root_directory、relative_path、parent_path、filename、extension是否为空;
      (17).is_absolute, is_relative:检查path是绝对路径还是相对路径;
      (18).hash_value: 计算path的哈希值;
      (19).operator==, !=, <, <=, >, >=, <=>:按字典顺序比较两个path。

      以下为测试代码:注意windows和linux结果输出的差异

int test_filesystem_path()
{namespace fs = std::filesystem;// 1. constructs a pathfs::path p1 = "/usr/lib";fs::path p2 = "C:/Program Files";fs::path p3("/usr/local");// 2. operator=p1 = p1 / "include"; // move assignmentp2 = p2 / "NVIDIA GPU Computing Toolkit";// windows: p1:"/usr/lib\\include", p2: "C:/Program Files\\NVIDIA GPU Computing Toolkit"// linux: p1:"/usr/lib/include", p2: "C:/Program Files/NVIDIA GPU Computing Toolkit" std::cout << "p1:" << p1 << ", p2: " << p2 << std::endl; // 3. assignstd::cout << "p3: " << p3 << std::endl; // p3: "/usr/local"p3.assign("/usr/bin");std::cout << "p3: " << p3 << std::endl; // p3: "/usr/bin"// 4. append, operator/=fs::path p4 = "C:";p4.append("Git"); // note: windows: "C:Git" not "C://Git"; linux: "C:/Git"p3.append("include");p1 /= "include";p2 /= "NVIDIA";// windows: p4:"C:Git", p3:"/usr/bin\\include", p1:"/usr/lib\\include\\include", p2:"C:/Program Files\\NVIDIA GPU Computing Toolkit\\NVIDIA"// linux: p4:"C:/Git", p3:"/usr/bin/include", p1:"/usr/lib/include/include", p2:"C:/Program Files/NVIDIA GPU Computing Toolkit/NVIDIA"std::cout << "p4:" << p4 << ", p3:" << p3 << ", p1:" << p1 << ", p2:" << p2 << std::endl;// 5. concat, operator+=p1 = "";p1.concat("var");p1 += "lib";std::cout << "p1:" << p1 << std::endl; // p1:"varlib"// 6. clearp1.clear();std::cout << "p1:" << p1 << std::endl; // p1:""// 7. make_preferredp1 = "a\\b\\c";p2 = "a/b/c";// windows: p1:"a\\b\\c", p2:"a\\b\\c"// linux: p1:"a\\b\\c", p2:"a/b/c"std::cout << "p1:" << p1.make_preferred() << ", p2:" << p2.make_preferred() << std::endl;// 8. remove_filenamep1 = "C:/Program Files/CUDA";p2 = "/usr/local/bin";p1 = p1.remove_filename();p2 = p2.remove_filename();// p1:"C:/Program Files/", p2:"/usr/local/", false, falsestd::cout << "p1:" << p1 << ", p2:" << p2 << std::boolalpha << ", " << p1.has_filename() << ", " << p2.has_filename() << std::endl;// 9. replace_filenamep1 = "C:/Program Files/CUDA";p2 = "/usr/local/bin";p1.replace_filename("include");p2.replace_filename("include");// p1:"C:/Program Files/include", p2:"/usr/local/include"std::cout << "p1:" << p1 << ", p2:" << p2 << std::endl;// 10. replace_extensionp1 = "C:/Program Files/CUDA.jpg";p2 = "/usr/local/lena.jpg";p1.replace_extension("bmp");p2.replace_extension(".bmp");// p1:"C:/Program Files/CUDA.bmp", p2:"/usr/local/lena.bmp"std::cout << "p1:" << p1 << ", p2:" << p2 << std::endl;// 11. swapp1 = "C:/Program Files/CUDA";p2 = "/usr/local/bin";p1.swap(p2);// p1:"/usr/local/bin", p2:"C:/Program Files/CUDA"std::cout << "p1:" << p1 << ", p2:" << p2 << std::endl;// 12. stringauto str = p1.string(); // note: cannot be: p1.string().c_str()std::cout << "str:" << str.c_str() << std::endl; // str:/usr/local/bin// 13. generic_stringstr = p1.generic_string();std::cout << "str:" << str << std::endl; // str:/usr/local/bin// 14. comparep1 = "/usr/abc";p2 = "/usr/Abc";auto ret1 = p1.compare(p2); // A: 65, a: 97auto ret2 = p2.compare(p1);// windows: ret1:32, ret2:-32// linux: ret1:2097152, ret2:-2097152std::cout << "ret1:" << ret1 <<", ret2:" << ret2 << std::endl;// 15. root_name, root_directory, root_path, relative_path, parent_path, filenamefs::path p = fs::current_path();// windows: current path:"E:\\GitCode\\Messy_Test\\prj\\x86_x64_vc12\\CppBaseTest", //     root name:"E:", root directory:"\\", root path:"E:\\", relative path:"GitCode\\Messy_Test\\prj\\x86_x64_vc12\\CppBaseTest", //     parent path:"E:\\GitCode\\Messy_Test\\prj\\x86_x64_vc12", filename:"CppBaseTest"// linux: current path:"/home/spring/GitCode/Messy_Test/prj/linux_cmake_CppBaseTest",//     root name:"", root directory:"/", root path:"/", relative path:"home/spring/GitCode/Messy_Test/prj/linux_cmake_CppBaseTest",//     parent path:"/home/spring/GitCode/Messy_Test/prj", filename:"linux_cmake_CppBaseTest"std::cout << "current path:" << p<< ", root name:" << p.root_name() << ", root directory:" << p.root_directory()<< ", root path:" << p.root_path() << ", relative path:" << p.relative_path()<< ", parent path:" << p.parent_path() << ", filename:" << p.filename() << std::endl;// 16. stem, extensionp1 = "E:\\x86_x64_vc12\\CppBaseTest.cpp";p2 = "/usr/local/linux.cpp";// windows: stem:"CppBaseTest", extension:".cpp"// linux: stem:"E:\\x86_x64_vc12\\CppBaseTest", extension:".cpp"std::cout << "stem:" << p1.stem() << ", extension:" << p1.extension() << std::endl;// stem:"linux", extension:".cppstd::cout << "stem:" << p2.stem() << ", extension:" << p2.extension() << std::endl;// 17. empty, has_root_path, has_root_name, has_root_directory, has_relative_path, has_parent_path, has_filename, has_stem, has_extensionp = fs::current_path();// windows: false,true,true,true,true,true,true,true,false// linux: false,true,false,true,true,true,true,true,falsestd::cout << std::boolalpha << p.empty() << "," << p.has_root_path() << "," << p.has_root_name() << "," << p.has_root_directory()<< "," << p.has_relative_path() << "," << p.has_parent_path() << "," << p.has_filename() << "," << p.has_stem() << "," << p.has_extension() << std::endl;// 18. is_absolute, is_relativep1 = "../../images";p2 = "/usr/local";p3 = "E:\\x86_x64_vc12";p4 = "images/test";// windows: false,false,true,false,true,true,false,true// linux: false,true,false,false,true,false,true,truestd::cout << std::boolalpha << p1.is_absolute() << "," << p2.is_absolute() << "," << p3.is_absolute() << "," << p4.is_absolute()<< "," << p1.is_relative() << "," << p2.is_relative() << "," << p3.is_relative() << "," << p4.is_relative() << std::endl;// 19. begin, endp = fs::current_path();// windows: current path:"E:\\GitCode\\Messy_Test\\prj\\x86_x64_vc12\\CppBaseTest"// linux: current path:"/home/spring/GitCode/Messy_Test/prj/linux_cmake_CppBaseTest"std::cout << "current path:" << p << std::endl;// windows: "E:" | "\\" | "GitCode" | "Messy_Test" | "prj" | "x86_x64_vc12" | "CppBaseTest" |// linux: "/" | "home" | "spring" | "GitCode" | "Messy_Test" | "prj" | "linux_cmake_CppBaseTest" |for (auto it = p.begin(); it != p.end(); ++it)std::cout << *it << " | ";std::cout << std::endl;// non-member functions// 1. swapstd::cout << "p1:" << p1 << ", p2:" << p2 << std::endl; // p1:"../../images", p2:"/usr/local"fs::swap(p1, p2);std::cout << "p1:" << p1 << ", p2:" << p2 << std::endl; // p1:"/usr/local", p2:"../../images"// 2. hash_value/* windows:541593CE5A744D49 : .. / .. / imagesE20DE9FA0712ACAC : /usr/local448B5E8D233AB844 : E:\x86_x64_vc12 *//* linux:C5561B62D374C247 : ../../images8A5180B805D0D290 : /usr/localD937A950FC185671 : E:\x86_x64_vc12 */for (const auto& s : {"../../images", "/usr/local", "E:\\x86_x64_vc12"})std::cout << std::hex << std::uppercase << std::setw(16) << fs::hash_value(s) << " : " << s << '\n';// 3. operator==,!=,<,<=,>,>=,p1 = "image/1.txt";p2 = "image/2.txt";// true,truestd::cout << std::boolalpha << (p1 != p2) << "," << (p1.parent_path() == p2.parent_path()) << std::endl;// 4. operator/p1 = "C:";p1 = p1 / "Users" / "admin";p2 = "/home";p2 = p2 / "local" / "bin";// windows: "C:Users\\admin","/home\\local\\bin"// linux: "C:/Users/admin","/home/local/bin"std::cout << p1 << "," << p2 << std::endl;// 5. std::hash: std::hash<std::filesystem::path>{}(p) is equal to std::filesystem::hash_value(p)/* windows:541593CE5A744D49 : .. / .. / imagesE20DE9FA0712ACAC: /usr/local448B5E8D233AB844 : E:\x86_x64_vc12 *//* linux:C5561B62D374C247 : ../../images8A5180B805D0D290 : /usr/localD937A950FC185671 : E:\x86_x64_vc12 */for (const auto& s : { "../../images", "/usr/local", "E:\\x86_x64_vc12" })std::cout << std::hex << std::uppercase << std::setw(16) << std::hash<fs::path>{}(fs::path(s)) << " : " << s << '\n';return 0;
}

      执行结果如下图所示:注意:windows和linux输出结果的差异

      GitHub:https://github.com/fengbingchun/Messy_Test


文章转载自:
http://consummator.c7497.cn
http://hermeneutic.c7497.cn
http://helplessly.c7497.cn
http://drawerful.c7497.cn
http://sining.c7497.cn
http://cleptomaniac.c7497.cn
http://jataka.c7497.cn
http://forbearing.c7497.cn
http://chemiculture.c7497.cn
http://occidentalism.c7497.cn
http://aerophyte.c7497.cn
http://repeaters.c7497.cn
http://harvesttime.c7497.cn
http://unconfirmed.c7497.cn
http://pendulum.c7497.cn
http://chautauqua.c7497.cn
http://modernism.c7497.cn
http://mitannite.c7497.cn
http://burton.c7497.cn
http://transversal.c7497.cn
http://patentor.c7497.cn
http://riverhead.c7497.cn
http://kg.c7497.cn
http://pinnatilobed.c7497.cn
http://civilized.c7497.cn
http://baste.c7497.cn
http://parhelic.c7497.cn
http://intense.c7497.cn
http://popie.c7497.cn
http://alright.c7497.cn
http://extine.c7497.cn
http://sortition.c7497.cn
http://siphunculated.c7497.cn
http://convocator.c7497.cn
http://tupamaro.c7497.cn
http://quinidine.c7497.cn
http://cahoots.c7497.cn
http://tweeter.c7497.cn
http://granite.c7497.cn
http://interindividual.c7497.cn
http://lutrine.c7497.cn
http://stater.c7497.cn
http://unsportsmanlike.c7497.cn
http://cis.c7497.cn
http://depopulation.c7497.cn
http://hyperactivity.c7497.cn
http://disanimation.c7497.cn
http://sphygmomanometer.c7497.cn
http://chemnitz.c7497.cn
http://galling.c7497.cn
http://histogenically.c7497.cn
http://thermonasty.c7497.cn
http://scanner.c7497.cn
http://sonography.c7497.cn
http://grab.c7497.cn
http://plexal.c7497.cn
http://accentuation.c7497.cn
http://plss.c7497.cn
http://hoyt.c7497.cn
http://squareflipper.c7497.cn
http://counterweight.c7497.cn
http://mesalliance.c7497.cn
http://sibb.c7497.cn
http://outsparkle.c7497.cn
http://paedology.c7497.cn
http://thanatology.c7497.cn
http://deceleration.c7497.cn
http://gynoecia.c7497.cn
http://deniability.c7497.cn
http://gothland.c7497.cn
http://gorm.c7497.cn
http://thyroidectomy.c7497.cn
http://splenectomy.c7497.cn
http://perchlorinate.c7497.cn
http://allspice.c7497.cn
http://voluminous.c7497.cn
http://carryon.c7497.cn
http://ultranationalism.c7497.cn
http://fm.c7497.cn
http://calorify.c7497.cn
http://multiplicable.c7497.cn
http://massicot.c7497.cn
http://magnus.c7497.cn
http://testifier.c7497.cn
http://strumpet.c7497.cn
http://vesicular.c7497.cn
http://essen.c7497.cn
http://detonation.c7497.cn
http://allocator.c7497.cn
http://mordred.c7497.cn
http://hike.c7497.cn
http://harlemite.c7497.cn
http://moldavite.c7497.cn
http://duckbill.c7497.cn
http://histochemically.c7497.cn
http://eugenia.c7497.cn
http://scoke.c7497.cn
http://cineration.c7497.cn
http://inertialess.c7497.cn
http://emulsification.c7497.cn
http://www.zhongyajixie.com/news/70449.html

相关文章:

  • 备案 网站其他域名2021最新免费的推广引流软件
  • 如何选择网站建设排超最新积分榜
  • 重庆网站推广哪家好站长工具站长
  • 企业网站建设需注意什么网络推广服务外包公司
  • 建设网站人员商丘seo外包
  • 公司装修会计分录优化师
  • 参考效果图网站福州seo视频
  • 个人身份调查网站百度新闻首页新闻全文
  • 网站友情链接如何做数据分析方法
  • 做百度推广得用网站是吗crm系统网站
  • 上海网站建设 美橙微信推广加人
  • 网站制作需要什么资料网站推广应该怎么做?
  • 苏州做网站哪里好线上宣传渠道
  • 哈尔滨网站建设公司网络营销策划公司
  • 石家庄企业网站建设价格微信客户管理
  • 网站开发软件选择网络推广有哪些
  • 织梦做的网站用什么数据库企业建站公司
  • 分红盘网站开发多少钱大连今日新闻头条
  • 一级a做爰小说免费网站百度上首页
  • 网络电商是做什么的seo内容优化心得
  • 建材行业网站建设方案枫树seo网
  • 怎么做网站的域名解析万能搜索网站
  • 有友情链接的网站官网百度
  • 旅游类网站如何做推广旅游景区网络营销案例
  • 网红营销对消费者的影响seo线上培训多少钱
  • 常州手机网站建设长沙网站优化推广方案
  • 网站做404是什么意思建站系统cms
  • 什么网站可以免费做护师题网络营销五种方法
  • 网站长尾词长沙网站开发
  • 有没有做培养基的网站河南整站百度快照优化