C++23: An Overview of Almost All New and Updated Featuresis evaluated during constant evaluation, then A is executed, otherwise B14 if consteval Why? We have std::is_constant_evaluated(), so what’s wrong with: if (std::is_constant_evaluated()) { /*A*/ which you cannot do in /*A*/ above if consteval cannot be used wrong is_constant_evaluated() can: if constexpr (std::is_constant_evaluated()) { /*A*/ } else { /*B*/ }15 if consteval Example: consteval std::println("{}", std::ranges::contains_subrange(v1, v2)); // true75 Changes to Ranges Library Several folding algorithms: ranges::fold_left(), fold_left_first(), fold_right(), fold_right_last(), fold_left_with_iter()0 码力 | 105 页 | 759.96 KB | 6 月前3
C++20: An (Almost) Complete Overviewinformation Includes the library feature test macros, such as: __cpp_lib_any, __cpp_lib_bool_constant, __cpp_lib_filesystem, …71 Immediate Functions – consteval constexpr function might be Immediate Functions – consteval consteval function required to always produce a constant at compile time, a non- constant result should be a compilation error called: immediate functions consteval InchToMm(const_inch) }; // Fine, everything is constant ✔ double dynamic_inch { 8 }; const auto mm2 { InchToMm(dynamic_inch) }; // Compilation error: not constant ❌73 constinit Static initialization order0 码力 | 85 页 | 512.18 KB | 6 月前3
C++20 STL Features: 1 Year of Development on GitHub(GH-399, Neargye) • More: • P0415R1 constexprAgain (GH-367, Neargye) • P0595R2 is_constant_evaluated() (GH-353, Jennifer Yao – MSVC compiler) • P1006R1 constexpr pointer_to() (GH-397, AdamBucior) key, using the container's predicate • Ordered: "Logarithmic" time, O(K + log N) • Unordered: "Constant" time, average O(K), worst O(N) • Only std::erase_if() is provided for associative • Avoids potential 0 码力 | 45 页 | 702.09 KB | 6 月前3
JVM 内存模型JVM 内存模型 Heap Method Area Runtime Constant Pool Thread Thread Thread PC Register JVM Stack Native Method Stack PC Register JVM Stack Native Method Stack PC Register JVM Stack Native Method0 码力 | 1 页 | 48.42 KB | 1 年前3
A Crash Course in Calendars, Dates, Time, and Time Zonesstd::duration from, contains: A tick A tick period = seconds between 2 ticks = rational constant template > class duration {...} Rep = type to represent 0 码力 | 43 页 | 551.60 KB | 6 月前3
C++高性能并行编程与优化 - 课件 - 08 CUDA 开启的 GPU 编程那样用循环。 下一课主题? GPU vs CPU • cudaStream 异步编程(流水线式并行) • Nsight profiler 性能分析(和 Vtune 类似) • texture 与 constant 内存(为啥要他们?) • 动态内存分配( GPU 上调用 malloc/free ) • curand 、 cufft 、 cublas 等常用库(大概) • GPU 红黑高斯 + 多重网格实战0 码力 | 142 页 | 13.52 MB | 1 年前3
共 6 条
- 1













