Skip to main content

Timeline for Flippable atomic boolean

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
Sep 15, 2022 at 6:52 comment added Toby Speight If we change to std::int_fast8_t, we might need explicit casts in some places for platforms where that's narrower than int. int is supposed to be the architectures "natural type" for arithmetic, so my inclination is to stick with that.
Sep 15, 2022 at 6:50 comment added Toby Speight Since the copy constructor is defaulted, which makes it deleted, then you lose nothing by removing the explicit - it still can't be called! (If you think you're using it, it's likely you're going via the conversion-to-bool operator without realising it. And that's fine.)
Sep 14, 2022 at 22:04 vote accept Antonio
Sep 14, 2022 at 21:57 comment added Antonio I was also thinking that the explicit for flippable_atomic_bool(bool init) doesn't help me much, and in fact it prevents me from doing copy initialization. What do I lose by removing it?
Sep 14, 2022 at 20:43 comment added Antonio Thanks! I was aware the casts were not really necessary, but I thought they would make the intent more explicit. I was thinking, would it make sense to use int_fast8_t in place of int?
Sep 14, 2022 at 16:39 history edited Toby Speight CC BY-SA 4.0
added 6 characters in body
Sep 14, 2022 at 16:34 history edited Toby Speight CC BY-SA 4.0
default constructor is inconsistent with standard atomic until C++20
Sep 14, 2022 at 16:18 history answered Toby Speight CC BY-SA 4.0