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.
Intro:
This is a fix that ensures your project can successfully build with
C++23
should you choose to upgrade. While exploring the project, I noticed that switching to a newer C++ version caused build failures. This pull request addresses those issues, allowing you to safely bump yourCMAKE_CXX_STANDARD
to23
if desired.Technical Changes:
Here is a screenshot of the build errors I was encountering.
You can easily reproduce them in the docker container with the following changes I have in my branch BuildFailuresC++23.
After inspecting the build errors, I was able to see that you were attempting to overload the
stream insertion
operators for the classesTag
,Id
, andMeasurement
. In each of these classes, you were defining the implementation for the stream operator, which inherently would call thetemplated fmt::format specialization
for each class. The issue is that the definition for eachstream insertion
would attempt to call theformat specialization
before it had been defined. In order to get around this error, you need to define thetemplate
before defining thestream insertion
because of their dependencies.I also removed the unneeded
friend
qualifier for theId
stream operator.After making the changes above, I was able to get the project to build with C++23 🎉.
I've created a branch here that has an additional dummy unit test to ensure C++23 features are now working. This C++23 feature is only available in gcc-14, but, nevertheless, the project will now build with certain C++23 features if supported by the compiler version.
I did not bump the
CMAKE_CXX_STANDARD
, but if you would like me to, let me know 😄