Rust vector iteration less than 1 minute read The following example shows difference of iterating vector items between for and with iter() method 1 2 3 4 let vs = vec![1, 2, 3]; for (v : vs) { // consumes v, owned v } 1 2 3 4 let vs = vec![1, 2, 3]; for (v : &vs) { // borrows vs, & v } 1 2 3 4 let vs = vec![1, 2, 3]; for (v : vs.iter()) { // this is equivalent to for (v: &vs) } 1 2 3 4 let vs = vec![1, 2, 3]; for (v : vs.into_iter()) { // this is equivalent to for (v: vs) } Share on Twitter Facebook LinkedIn Previous Next
C++ - A Tour of C++ Executors, Part 2 (Eric Niebler, CppCon 2021) 11 minute read Eric Niebler - Working with Asynchrony Generically: A Tour of C++ Executors (part 2/2) - CppCon 2021
C++ - A Tour of C++ Executors, Part 1 (Eric Niebler, CppCon 2021) 9 minute read Eric Niebler - Working with Asynchrony Generically: A Tour of C++ Executors (part 1/2) - CppCon 2021
C++ - Implementing Control Flow with Sender/Receiver (Steve Downey) 7 minute read Steve Downey - Using the C++ Sender/Receiver Framework: Implement Control Flow for Async Processing
C++26 std::execution: then vs let_value, and the Full Algorithm Catalog 9 minute read C++26 finally ships std::execution (P2300) — the sender/receiver framework for asynchronous and parallel programming. Two of its algorithms get confused cons...