Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Hold on. This wasn't a wrapper around a loop pattern - this was a first-class atomic operation, sitting right there next to fetch_add and fetch_or. Java doesn't have this. C++ doesn't have this. How could Rust just... have this?

C++26 (work-in-progress) does have std::atomic<T>::fetch_max . Not implemented in any toolchains yet, though.

https://en.cppreference.com/w/cpp/atomic/atomic/fetch_max

https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p04...



That info is included later in the article:

> PS: After conducting this journey I learned that C++26 adds fetch_max too!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: