sparcians / map

Modeling Architectural Platform

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support compilation as dependency in C++20 project

acrucker opened this issue · comments

These changes are needed to compile using Sparta's headers in a C++20 or beyond project, due to C++20's DR 2237: https://cplusplus.github.io/CWG/issues/2237.html.

The changes should still be fine for C++17.

diff --git a/sparta/sparta/simulation/StateTracker.hpp b/sparta/sparta/simulation/StateTracker.hpp
index ec5cbf41..950d286e 100644
--- a/sparta/sparta/simulation/StateTracker.hpp
+++ b/sparta/sparta/simulation/StateTracker.hpp
@@ -103,7 +103,7 @@ namespace sparta {
                 const std::weak_ptr<StatePool<T>> & weak_pool) :
                 weak_pool_ptr_(weak_pool) {}
 
-            StateTrackerDeleter<T>() : valid_(false) {}
+            StateTrackerDeleter() : valid_(false) {}
 
             inline void operator()(StateTrackerUnit<T> * ptr) const {
                 if(!valid_ || !ptr) {
@@ -178,7 +178,7 @@ namespace sparta {
 
             //! The Default Ctor is deleted because StatePool cannot be created
             //  without a valid state tracking filename.
-            StatePool<T>() = delete;
+            StatePool() = delete;
 
             //! A file name is a must when constructing StatePool.
             explicit StatePool<T>(const std::string & tracking_filename) :

Neat! Was looking to try c++20. Are these really the only changes?!? That's pretty cool.

Go ahead and create a cross-fork PR and I'll approve it and merge it.

This work is now complete. Thank for the fix.
BTW, do you see any odd behavior with C++20? I'm playing around with it now and have an odd seg fault in the allocator that I'm trying to track down. Want to make sure it's on my end only.