cereal
cereal copied to clipboard
Cereal and C++20
I'm trying to use cereal library in my C++20 pet project (using current gcc 10 snapshot). As far as the library is considered there's only one issue (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html), implicit 'this' capture in two lambdas in cereal.hpp which results in a warning. Quite easy to fix. But there are two more "complicated" issues within tests:
-
basic_string.cpp - as far as I understand the error is in doctest
has_insertion_operatortrait. The root cause of this is:operator<<(basic_ostream<char, _Traits>&, wchar_t) = delete;(yes, this is explicitly deleted in C++20 stdlib). Assuming we aim at C++11 and onwards we can replace the check with slightly modified version of answer from SO: https://stackoverflow.com/a/22759544 - at least it won't fail to compile with C++2a enabled. The question is if we want to modify it in place or rather target to fix it upstream? -
performance.cpp - this one I don't have idea how to approach. The problem is in boost library, basically boost::format won't compile with C++20 because it use two argument Allocator::allocate somewhere deep. This was removed in C++20.
Any thoughts?
Things to fix
- [x] implicit this capture in cereal.hpp #640
- [x] doctest ostream output for wchar_t https://github.com/onqtam/doctest/issues/357
- [ ] boost::format two argument allocator (to compile performance.cpp)
doctest fix is now merged into the dev branch. In parallel I was trying to use boost::format() from the latest boost develop branch and it seem to compile well with -std=c++20 switch on gcc 10. I'll try to setup a fresh environment to compile cereal with latest versions of boost and doctest and see if everything's fine, potentially closing this issue.
Why not use the fmt lib instead of boost format? It's going to be in C++20 anyways.
Great – thanks for the update. If this looks to fix things I’ll update our internal doctest. From: Łukasz GemborowskiSent: Thursday, June 11, 2020 9:30 AMTo: USCiLab/cerealCc: SubscribedSubject: Re: [USCiLab/cereal] Cereal and C++20 (#638) doctest fix is now merged into the dev branch. In parallel I was trying to use boost::format() from the latest boost develop branch and it seem to compile well with -std=c++20 switch on gcc 10. I'll try to setup a fresh environment to compile cereal with latest versions of boost and doctest and see if everything's fine, potentially closing this issue.—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.