C++23: An Overview of Almost All New and Updated FeaturesLibrary Changes to Ranges Library Changes to Views Library std::expected std::move_only_function<> std::spanstream std::byteswap() std::to_underlying() Associative Containers Heterogeneous Library Changes to Ranges Library Changes to Views Library std::expected std::move_only_function<> std::spanstream std::byteswap() std::to_underlying() Associative Containers Heterogeneous Library Changes to Ranges Library Changes to Views Library std::expected std::move_only_function<> std::spanstream std::byteswap() std::to_underlying() Associative Containers Heterogeneous0 码力 | 105 页 | 759.96 KB | 6 月前3
Bringing Existing Code to CUDA Using constexpr and std::pmrspecifier declares a function as being a kernel. Such a function is: • Executed on the device, • Callable from the host. The __device__ execution space specifier declares a function that is: • Executed nvidia.com/cuda/cuda-c-programming-guide/ index.html#function-declaration-specifiers 36 |The __host__ execution space specifier declares a function that is: • Executed on the host, • Callable from the declare a function with only the __host__ execution space specifier or to declare it without any of the __host__, __device__, or __global__ execution space specifier; in either case the function is compiled0 码力 | 51 页 | 3.68 MB | 6 月前3
Working with Asynchrony Generically: A Tour of C++ Executorswith a function. upon_[error|done](sender, fn) → sender … transforms the error and done signals with a function. let_[value|…](sender, fn) → sender … passes the result of input sender to function, which std::move(work) ).value(); }50 SENDER/RECEIVER AND COROUTINES By returning a sender, an async function puts the choice of whether to use coroutines or not in the hands of the caller.51 COMING UP treated like a black box. goto is an unstructured control flow construct conditional loop function call goto59 FIRE-AND-FORGET TASK MODELS ARE UNSTRUCTURED Fire-and-forget work is like goto.0 码力 | 121 页 | 7.73 MB | 6 月前3
应用 waPC (rust) 做软件测试工具wapc::register_function("ping", ping); } fn ping(msg: &[u8]) -> wapc::CallResult { …. Ok(msg.to_vec()) } waPC Guest Rust waPC • Use wapc_init to register function • Register_function can only be be used inside WAPC_init • Register_function cannot be called inside ping • _start is meant to support tinygo’s wasm • waPC host will still run both "wapc_init" and "_start" during intialization intialization waPC Guest Rust waPC • Use wapc_init to register function • _start also can • Util Lib uses wapc_init, users build on top of ”_start” extern crate wapc_guest as guest; extern crate Regex;0 码力 | 30 页 | 2.50 MB | 1 年前3
C++20: An (Almost) Complete OverviewTristan Brindle Thursday, September 17 • 12:00coroutines15 Coroutines What’s a coroutine? A function, with one of the following: co_await: suspends coroutine while waiting for another computation typename V::value_type; T x { }; T::static_function(); // ... }; With C++20: [](const vector & vec) { T x { }; T::static_function(); // ... };29 Templated Lambda Expressions std::atomic Wait/block for an atomic object to change its value, notified by a notification function Can be more performant than polling Methods wait() notify_one() notify_all()45 std::atomic_ref 0 码力 | 85 页 | 512.18 KB | 6 月前3
Making Libraries Consumable for Non-C++ DevelopersRun down of some approaches Just be like C? – post-1972 Common Object Model (COM) – 1993 Foreign function interface (libffi) – 1996 Simplified Wrapper and Interface Generator (SWIG) – 1996 JVM – Java Native dev- >get_data_from(); return d.a + d.b; The get_data_from() function returns the struct in registers, but the get_data_from() member function returns in caller provided memory. This is often unexpected int b; }; /* Get data from device ‘dev’. */ data_t get_data_from(size_t dev); How does this function fail? C++ exceptions have no universal binary contract. Meaning the consumer may not be prepared0 码力 | 29 页 | 1.21 MB | 6 月前3
Performance Lets dive into Performance issueslayouts with one GridLayout. Loops • Beware of function and memory allocations inside of loops. You see this as a standard pattern. function loopFunction () { var val = 0; for (var i=0;i<100000;i++) i=0;i<100000;i++) { doSomething( () => { val++; } ); } } Loops • Proper way function loops() { var val = 0, fun = function() { val++; }; for (var i=0;i<100000;i++) { doSomething(fun);0 码力 | 15 页 | 1.71 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 03 现代 C++ 进阶:模板元编程为了灵活性,可以用 std::function 容器。 • 只需在后面尖括号里写函数的返回类型和 参数列表即可,比如: • std::function; 如何避免用模板参数 2 :无捕获的 lambda 可以传为函数指针 • 另外,如果你的 lambda 没有捕获任何局 部变量,也就是 [] ,那么不需要用 std::function 作为参数:用 template 然后 Func const & 做类型。 2. lambda 作为返回值:用 auto 做类型。 3. 牺牲性能但存储方便: std::function 容器。 4. lambda 作为参数:通常用 [&] 存储引用。 5. lambda 作为返回值:总是用 [=] 存储值。 • 其实 lambda 还有更多语法,比如 mutable , 0 码力 | 82 页 | 12.15 MB | 1 年前3
C++高性能并行编程与优化 - 课件 - 16 现代 CMake 模块化项目管理指南这个文件。 • 这样你可以在 XXX.cmake 里写一些你常用的函数,宏,变量等。 macro 和 function 的区别 • macro 相当于直接把代码粘贴过去,直接访问调用者的作用域。这里写的相对路径 include 和 src ,是基于调用者所在路径。 • function 则是会创建一个闭包,优先访问定义者的作用域。这里写的相对路径 include 和 src ,则是基于定义者所在路径。 ,则是基于定义者所在路径。 https://cmake.org/cmake/help/latest/command/function.html https://cmake.org/cmake/help/latest/command/macro.html include 和 add_subdirectory 的区别 • include 相当于直接把代码粘贴过去,直接访问调用者的作用域。这里创建的变量和外面共 外面共 享,直接 set(key val) 则调用者也有 ${key} 这个变量了。 • function 中则是基于定义者所在路径,优先访问定义者的作用域。这里需要 set(key val PARENT_SCOPE) 才能修改到外面的变量。 第二章:第三方库 / 依赖项配置 用 find_package 寻找系统中安装的第三方库并链接他们 find_package 命令 • 常用参数列表一览:0 码力 | 56 页 | 6.87 MB | 1 年前3
陈东 - 利用Rust重塑移动应用开发-230618to use Rust to provide high performance 2); Photo / image / chart Rust FFI Rust FFI (Foreign Function Interface) refers to the ability of Rust programming language to interface with code written in IOS - Rust targets for IOS - Build the static universal library for different target - Call the function on the swift code 利用 Rust 重塑移动应用开发 Photo / image / chart Rust 在 Keystone 业务上的实践 Rust Crypto as linked library into the application Protocol Buffers 利用 Rust 重塑移动应用开发 Directly expose the function to IOS/Android? - Hard to maintain - Hard to define the return value - Hard to process the error0 码力 | 22 页 | 2.10 MB | 1 年前3
共 20 条
- 1
- 2













