I'm looking for a library offering an std::ostream implemented on top of something other than the operating system's calls. It should be implemented either using C-style printf() commands, or alternatively, over some generic underlying primitives which I could replace.

Required features:

  • Gratis.
  • Libre.

Desired features:

  • Actively maintained.
  • Available under the Apache Public License v2.
  • Available under 3-BSD or 2-BSD.
  • Tested on both Linux and Windows.
  • Some constexpr functionality (yes, I know that' not quite like C++ ostreams)
  • Header-only would be nice.

I think uSTL might fit the bill.

Its ostream implementation appears to be based on c style primitives.


See both here (quote: "Most calls use snprintf for output and thus use whatever locale libc uses") and the source itself, e.g. here , which uses only vsnprintf as far as I can see.

License: It's MIT licensed.

Is it maintained?

Well, the main page says it's obsolete since C++11, but the git repo appears to be alive and well (last commit made a few months ago).

It says it isn't supported on Windows, only on Linux, but there's this repo (uSTL-Windows). It looks abandoned, but it's a start.

It even uses some constexpr functionality, as per your request. Source: this github search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.