Is there a memset equivalent for std::array? I think memset is supposed to perform better when initializing an array to zero than looping over the array. I searched one for std::array but could not find anything online.
Use the array's fill() method, that is what its purpose is.
If you fill it with 0 (for integers, for instance), then the compiler may optimize it if it can (often does, you can look at the generated code).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With