Quick Q: Is there std::memset equivalent for std::array?

Quick A: the fill() function.

Recently on SO:

Is there std::memset equivalent for std::array?

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).

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.