Remove #include <iostream> to allow compiling for small embedded systems #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm using the library on a 128kB STM32F4 -processor, and #include brings in about 140kB of data, which obviously won't fit in the flash. Without iostream, this library increases code size by about 400 bytes when using pcg32, which is pretty ok (although could probably still be trimmed).
Admittedly it's a bit brute force to just remove the header inclusions, and that it works at all is based on all the iostream -related code being in templates, so that when they're not used there's no problem. If you do use them, you have to include yourself and the order does matter (I had to change one of the tests to make them compile).
Another approach would be to merge pull request #4 , switching the extras header to also use forward declarations.
Yet another approach, maybe more robust but less elegant, would be to #ifdef out the iostream headers if some flag (PCG_DONOTUSEIOSTREAM ? ) is defined.
Removing is not absolutely necessary, but I'm not sure what it's used for here, the only relevant part I could find is one use of placement new?