Hacker News new | ask | show | jobs
by snovv_crash 1422 days ago
You can also 'const' your std::vector when you declare it and it won't work. Any linter or having warnings turned on will catch these issues.
1 comments

const doesn't make a difference in this case. It's about the passed-by-reference object being destroyed after the function returns. That is because the object was passed as a temporary.