C++ String Conversion: Exploring std::from_chars in C++17 to C++26

1 Before C++17 2 Converting From Characters to Numbers: from_chars 2.1 示例 3 性能 4 C++23 更新 5 C++26 更新 6 C++ 中对 std::from_chars 的编译器支持 7 总结 本文为摘录,原文为: https://www.cppstories.com/2018/12/fromchars/ 随着引入 C++17,C++标准库通过添加 std::from_chars...

October 14, 2024 · Yang Yingchao

Spans, string_view, and Ranges - Four View types (C++17 to C++23) - C++ Stories

1 String View (C++17) SVG Image 1.1 string_view vs const string & 2 Span (C++20) 3 Range Views (C++20) 4 MD Span (C++23) 5 Comparing Spans to Range Views 6 Summary 本文为摘录,原文为: https://www.cppstories.com/2023/four-views-in-cpp23/ 在本博客文章中,我们将探讨现代 C++中引入的几种不同的视...

October 10, 2023 · Yang Yingchao

What it means when you convert between different shared_ptrs - The Old New Thing

本文为摘录,原文为: https://devblogs.microsoft.com/oldnewthing/20230817-00/?p=108611 C++中的 shared_ptr 管理一个引用计数指针。通常情况下,它是一个指向对象的指针,当最后一个引用过期时将被删除。但它不一定非得是这...

August 18, 2023

All Major C++17 Features You Should Know

1 Language Features 1.1 New auto rules for direct-list-initialization 1.2 static_assert with no message 1.3 typename in a template template parameter 1.4 Nested namespace definition 本文为摘录,原文为: https://www.cppstories.com/2017/01/cpp17features/ 1 Language Features 1.1 New auto rules for direct-list-initialization 1.2 static_assert with no message static_assert() 可以不用再写 message 了, 类似 C assert 1.3 typename in a template template...

std::initializer_list in C++

1 Referencing local array 2 The cost of copying elements 本文为摘录,原文为: https://www.cppstories.com/2023/initializer_list_improvements/ 1 Referencing local array std::initializer_list 在使用中会转化成为常量对象的匿名局部数组: std::initializer_list<int> wrong() { // for illustration only! return { 1, 2, 3, 4}; } int main() { std::initializer_list<int> x = wrong(); } The...