Skip to content
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

[rosconsole] C++ stream operators for containers? #1400

Closed
bmagyar opened this issue May 15, 2018 · 1 comment
Closed

[rosconsole] C++ stream operators for containers? #1400

bmagyar opened this issue May 15, 2018 · 1 comment

Comments

@bmagyar
Copy link
Contributor

bmagyar commented May 15, 2018

I've been using a header file that I carry with me from project to project for a while now.
The main contribution of it is this template that allows to print vectors without having to write the same boilerplate over and over again.

template <typename T>
std::ostream& operator<< (std::ostream& stream, const std::vector<T>& list)
{
  stream << "[";
  for(const T& elem : list)
    stream << elem << ", ";
  if(not list.empty())
    stream.seekp(-2, std::ios_base::end); // remove last ", "
  stream << "]";
  return stream;
}

Is something like this welcome in rosconsole or you are trying to offer the same functionality with printf-style logging and other languages?

@dirk-thomas
Copy link
Member

This issue was moved to ros/rosconsole#10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants