3 ms·
See also: https://www.boost.org/doc/libs/1_65_0/libs/smart_ptr/doc/html/smart_ptr.html#local_shared_ptr https://www.boost.org/doc/libs/1_65_0/libs/smart_ptr/do
by PaulDavisThe1st 3y ago
See also:
https://www.boost.org/doc/libs/1_65_0/libs/smart_ptr/doc/html/smart_ptr.html#local_shared_ptr https://www.boost.org/doc/libs/1_65_0/libs/smart_ptr/doc/htm...
i.e. a single-threaded non-atomic shared_ptr
Rust fans can dislike on the "C++ has no central library system like crates" all they want, but there's not many things you actually need when programming that don't exist for C++, even if you don't like them not coming in a little box that looks like other little boxes.
- FpUser 3y agoThis. As soon as I need something it is quick online search away. Amount of stuff available for C++ is staggering
- nevi-me 3y agoThe criticism is less about what's available, for there is more available in C++ than Rust. The criticism is about ease of packaging in a cross-platform magnet that is easy enough.
- frozenport 3y agoBoost is extremely popular. I've used it in almost all my projects.
- FpUser 3y agoI have exactly zero problems using the same C++ code on Windows (debug and development) and then building and running it on Linux in production
- 0xfaded 3y agoWhile we're at it, std::atomic<std::shared_ptr<T>> https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic2 https://en.cppreference.com/w/cpp/memory/shared_ptr/atomic2
- dureuill 3y agoYes, this is discussed in the article, I do not understand your point.
- dureuill 3y agoThe point of the article isn't that single-threaded non-atomic shared pointers are unfeasible in C++, it is that their usage is too dangerous. The fact that it wasn't included in the standard library for this reason is an argument for this. The fact that even `shared_ptr` has thread-safety footguns, one of which made it to the famous C++ talk, “Curiously Recurring C++ Bugs at Facebook”[1], is another. By the way, every single of the bugs from that talk is impossible in safe Rust. [1]: https://youtu.be/lkgszkPnV8g?si=cCWASihvIGJ25Jf3 https://youtu.be/lkgszkPnV8g?si=cCWASihvIGJ25Jf3