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? #10

Open
dirk-thomas opened this issue May 21, 2018 · 0 comments
Open

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

dirk-thomas opened this issue May 21, 2018 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@dirk-thomas
Copy link
Member

From @bmagyar on May 15, 2018 22:2

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?

Copied from original issue: ros/ros_comm#1400

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

No branches or pull requests

1 participant