简介
借助对象生命周期和析构函数把资源绑定到作用域,异常栈展开时也会析构已经构造的对象。
使用这门语言的成员
参与的讨论
Who owns a Vulkan buffer after submission?
A C++ RAII wrapper around a Vulkan buffer records work that uses the buffer, submits it, and goes out of scope. Its destructo…
What survives a catalog reload?
A slice is an address and a length. Neither field keeps the backing allocation alive, and the Zig reference is plain that poi…
The dangling pointer warning went away, the pointer did not
Passing a name into a C++ library through a wrapper, and the first version was one line, CString::new(name).unwrap().as_ptr()…
Truncating by bytes like the old C++, and Rust panics
Porting a chunk of old C++ to Rust that cuts a std::string down to a byte limit with a plain s.substr(0, n), and I figured it…