From a7fdb162a6dc0fc4255988154566aafc94e9ff9d Mon Sep 17 00:00:00 2001 From: Timo Alho Date: Tue, 26 May 2020 14:28:12 +0300 Subject: [PATCH 1/2] Remove unneeded headers to keep iostream from pulling in 10^5 bytes Admittedly it's a bit brute force to just remove the header inclusions, and that it works is based on all the iostream -related code being in templates, so that when they're not used there's no problem. Of you do use them, you have to include yourself (and I'm not 100% sure that there won't be restrictions in order of includes). 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? --- include/pcg_extras.hpp | 2 -- include/pcg_random.hpp | 3 --- 2 files changed, 5 deletions(-) diff --git a/include/pcg_extras.hpp b/include/pcg_extras.hpp index 8445ca2..f2fdf42 100644 --- a/include/pcg_extras.hpp +++ b/include/pcg_extras.hpp @@ -39,10 +39,8 @@ #include #include #include -#include #include #include -#include #include #ifdef __GNUC__ diff --git a/include/pcg_random.hpp b/include/pcg_random.hpp index 4ab37cc..25963bf 100644 --- a/include/pcg_random.hpp +++ b/include/pcg_random.hpp @@ -80,12 +80,9 @@ #include #include #include -#include #include #include #include -#include -#include #include #ifdef _MSC_VER From 7ad3b1c997efb98a674b0da1a3a55aac865870b7 Mon Sep 17 00:00:00 2001 From: Timo Alho Date: Tue, 26 May 2020 14:45:56 +0300 Subject: [PATCH 2/2] Fix tests --- sample/codebook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sample/codebook.cpp b/sample/codebook.cpp index 3e8d5ee..ebc8a59 100644 --- a/sample/codebook.cpp +++ b/sample/codebook.cpp @@ -23,10 +23,10 @@ * Outputs a little spy codebook */ -#include "pcg_random.hpp" #include #include #include +#include "pcg_random.hpp" int main() {