New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ostream operator template for std::vectors #1116
Conversation
@terhorstd: you can either fix the format of the code you're proposing or start another PR to change the formatting guidelines as discussed two weeks ago and to make your code pass the tests. Both options would be fine for me at this point in time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terhorstd Good idea, but see my comments in the code. In contrast to @jougs, I'd ask you to format the code according to our current guidelines.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
{ | ||
os << ", "; | ||
} | ||
os << element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@terhorstd Don't you need to set first
to false somewhere?
Streaming
std::vector
s just streams all elements (given that the elements supportcout << obj;
). This is very useful in many circumstances and should not be implemented each time anew.