erikerlandson / st_tree

A fast and flexible c++ template class for tree data structures
https://github.com/erikerlandson/st_tree/wiki
Apache License 2.0
95 stars 20 forks source link

Fixed std::allocator usage for C++17 and C++20 #28

Closed stephenberry closed 3 years ago

stephenberry commented 3 years ago

Fix to build once again in C++20

rebind was deprecated in C++17 and removed in C++20 construct, destroy, and deallocate were deprecated and removed likewise and now the proper solution is to use std::allocator_traits

I also added .DS_store to the .gitignore as it is generated on my Mac

erikerlandson commented 3 years ago

@stephenberry thanks for contributing!

Is the new, non-deprecated, allocator code backward compatible with pre c++17 compilers? Or: what is the earliest c++YY that this code with work with?

In its original incarnation, st_tree was compilable back to c++98, but I believe the most recent PR I merged pushed that up to c++11, so I'm mostly just trying to keep track of what the requirements are.

stephenberry commented 3 years ago

Good question, I should have noted that these changes use C++11 features (e.g. std::allocator_traits). So, the code already used C++11 features and this should maintain that compatibility.

erikerlandson commented 3 years ago

unit tests are building and passing with cmake -D CMAKE_CXX_STANDARD=11 . Also 14, 17 and 20 LGTM, will merge. Thanks @stephenberry !

stephenberry commented 3 years ago

You're welcome. Thanks for such a great tree library!