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

Save to:
Instapaper Pocket Readability

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

You must sign in or register to add a comment.

Comments (0)

There are currently no comments on this entry.