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

osyncstream support #132

Open
nikolay-govorov opened this issue Mar 3, 2023 · 0 comments
Open

osyncstream support #132

nikolay-govorov opened this issue Mar 3, 2023 · 0 comments

Comments

@nikolay-govorov
Copy link

In C++ 20 add syncstream - wrappers that allows to synchronize output into a single stream. Due to the fact that it wraps the stream, rbuf does not return a real pointer and rang believes that the stream does not support color at all.

For example:

#include <iostream>
#include <syncstream>

#include "rang.hpp"

int main() {
  using namespace std;
  using namespace rang;

  std::osyncstream sout(std::cout);

  cout << fg::red << "Rang styled text!!" << style::reset << endl; // colofull
  sout << fg::red << "Rang styled text!!" << style::reset << endl; // plain text

  return 0;
}

It would be cool to specify rand to work with it. The instance of the class (msg in the example) has the get_wrapped method, which return the correct buffer, which can be checked correctly.

What do you think about it? I'm not a very experienced C++ programmer, but I could try to send a PR if you think it's a good idea.

@nikolay-govorov nikolay-govorov changed the title syncstream support osyncstream support Mar 3, 2023
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

1 participant