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++ - Another nice talk about constexpr with tuple less than 1 minute read This is an excellent talk discussing tuples in the context of constexpr. It is highly recommended for anyone seeking a deeper understanding of constexpr in C...
PyTorch - Basic but contains most of useful information less than 1 minute read The following article explain the basic introduction of PyTorch.
C++ - Deducing this feature 1 minute read C++23 introducing a new feature called deducing this. This is solving the following issues.