My favorite Rust function
blog.jabid.in
My favorite Rust function
1–10 of 197 posts
Re: My favorite Rust function
#2Re: My favorite Rust function
#3Re: My favorite Rust function
#4There’s a number of fun C++ ones similar in spirit: std::move, for example.
template
constexpr typename std::remove_reference::type&&
move(_Tp&& __t) noexcept
{ return static_cast::type&&>(__t); }Re: My favorite Rust function
#5There’s a number of fun C++ ones similar in spirit: std::move, for example.
std::move's implementation not quite as elegant, though (this is from the GCC source): template constexpr typename std::remove_reference ::type&& move(_Tp&& __t) noexcept { return static_cast ::type&&>(__t); }
Re: My favorite Rust function
#6There’s a number of fun C++ ones similar in spirit: std::move, for example.
Re: My favorite Rust function
#7Re: My favorite Rust function
#8Wow, elegant. This was probably conceived as an idea during the design phase of the language, it seems right .
But I remember the words "drop" and "dup" being used since the early days of linear logic too. I believe they come from Forth, where they do pretty much the same thing! [2]
[1] http://homepages.inf.ed.ac.uk/wadler/papers/linear/linear.ps