关于atomic 自增 compare 问题

https://godbolt.org/z/rh6cK4acx

atomic_int a = 10;

if (++a == 10) {
}

if (a.fetch_add(1) == 9) {
}

posted @ 2024-01-10 16:04  stdpain  阅读(12)  评论(0编辑  收藏  举报