std::bitset is a trivially copyable type in every implementation, although I don't think it's required to be by the standard.

If you're willing to make some basic assumptions about its implementation, you can use std::memcpy to super-efficiently copy all of its bits out of the container.

Maybe we can sneak that into https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2024/p3103r2.html, one of my proposals.