tdulcet / Table-and-Graph-Libs

📈 Console Table and Graph/Plot Libraries
GNU General Public License v3.0
43 stars 5 forks source link

support `c++14` #1

Closed t-bltg closed 1 year ago

t-bltg commented 1 year ago

Thanks for this very convenient package.

Would you consider lower the required std to c++14 ? This header only library is very convenient for insitu plotting in large c++ codes, which sometimes must be compiled with older compilers.

Compiles and runs fine on c++14 and onwards:

for cxx in g++ clang++; do
  for std in c++14 c++17 c++20; do
    $cxx -std=$std tables.cpp && ./a.out
    $cxx -std=$std graphs.cpp && ./a.out
  done
done
tdulcet commented 1 year ago

Thanks for the PR! I am glad the library is useful for you.

I am fine with merging this for now... However, I have been working on a major update for these libraries (to add histogram and line plot support amount other features), which will use more C++17 syntax, so I am not sure how long I will be able to maintain the C++14 support.

t-bltg commented 1 year ago

Awesome thanks. I'm also the maintainer of https://github.com/JuliaPlots/UnicodePlots.jl, but admittedly I sometimes have to dig in c++ codes, so I'm exploring plot possibilities in raw c++. Let me know if I can help in any way ;)

tdulcet commented 1 year ago

Yes, your library is awesome and it looks like you have added a lot of cool features since I last looked at it (you probably noticed that it is linked from my README). I am going to have to check your code and see how you implemented a few things...

Thanks for the offer! Please feel free to create more PRs if you are ever interested in porting some of your Julia code to C++ and/or Python.

Anyway, I just went ahead and pushed the first part of my big update: https://github.com/tdulcet/Tables-and-Graphs/commit/73411c18cb51d9209478e1ca57b4fa39f92b2c3e. This changes the style and color options to use Enums and adds a new check option to disable checking the terminal size. It also changes to the graphing library to always show the border and axis labels when the respective options are enabled, even if they would otherwise be out of view. Feedback is welcome. I have a prototype of second part, but it still needs to some more testing before I can push it...

I did have to make a minor fix to your changes in this PR to resolve some compiler warnings, which I did not notice before merging this. Specifically, I had to change the return type of both size() functions from auto to size_t. I also made them a constexpr while I was at it.