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
Is std::mdspan a Zero-overhead Abstraction? - Oleksandr Bakirov - CppCongenerating identical assembly for different color spaces, without relying on non-standard Identical Code Folding. ● It allows to formulate in-place color conversions, for example, from RGB to BGR. ● Good as std::integral_constant{}}; 14 } 15 }; 71RGB to Grayscale conversion 72Color spaces 1 struct RGB {}; 2 3 auto channelCount(RGB) { 4 return std::integral_constant {}; 6 7 struct Grayscale {}; 8 9 auto channelCount(Grayscale) { 10 return std::integral_constant {}; 11 } 73Conversion using mdspan (draft) 1 void convertColorSpace( 2 mdspan 0 码力 | 75 页 | 1.04 MB | 6 月前3
julia 1.10.10Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 27.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 358 27.8 Indirect Calls julia> pi = 3 3 julia> pi 3 julia> sqrt = 4 4 However, if you try to redefine a built-in constant or function already in use, Julia will give you an error: julia> pi π = 3.1415926535897... julia> FLOATING-POINT NUMBERS 21 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.10.9Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 358 27.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 358 27.8 Indirect Calls julia> pi = 3 3 julia> pi 3 julia> sqrt = 4 4 However, if you try to redefine a built-in constant or function already in use, Julia will give you an error: julia> pi π = 3.1415926535897... julia> eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 1692 页 | 6.34 MB | 3 月前3
Julia 1.11.4Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function already in use, Julia will give you an error: julia> pi π = 3.1415926535897... julia> eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.5 DocumentationGarbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function already in use, Julia will give you an error: julia> pi π = 3.1415926535897... julia> eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.11.6 Release NotesGarbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 380 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function already in use, Julia will give you an error: julia> pi π = 3.1415926535897... julia> eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2007 页 | 6.73 MB | 3 月前3
Julia 1.12.0 RC1Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 384 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function that you have explicitly imported, Julia will give you an error: julia> using Base: eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta4Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 383 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function that you have explicitly imported, Julia will give you an error: julia> using Base: eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2057 页 | 7.44 MB | 3 月前3
Julia 1.12.0 Beta3Garbage Collection Safety . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 28.7 Non-constant Function Specifications . . . . . . . . . . . . . . . . . . . . . . . . . 383 28.8 Indirect Calls Base.length length (generic function with 79 methods) However, if you try to redefine a built-in constant or function that you have explicitly imported, Julia will give you an error: julia> using Base: eps(0.0) 5.0e-324 The distance between two adjacent representable floating-point numbers is not constant, but is smaller for smaller values and larger for larger values. In other words, the representable0 码力 | 2057 页 | 7.44 MB | 3 月前3
共 195 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20













