We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following is a minimal example which does not compile for me under C++ 17:
#include <cereal/archives/json.hpp> template<class T, class P> class NamedType { public: NamedType() = default; NamedType(T value) : _value(value) {} const T& get() const { return _value; } private: T _value; }; namespace cereal { template <typename Archive, typename T, typename P> T save_minimal(Archive const&, const NamedType<T, P>& t) { return t.get(); } /** * Cereal deserialization for binary and text (JSON) only. */ template <typename Archive, typename T, typename P> void load_minimal(Archive const&, NamedType<T, P>& t, T const& value) { t = NamedType<T, P>(value); } } int main() { using NamedSize = NamedType<size_t, struct Size>; NamedSize c(10); std::ostringstream os; { cereal::JSONOutputArchive arout(os); arout(CEREAL_NVP(c)); } std::string tmp = os.str(); std::cout << tmp << "\n"; std::stringstream ss2(tmp); { cereal::JSONInputArchive arin(ss2); NamedSize c2; arin(c2); } return 0; }
The compiler outputs something to the effect of:
tools/cereal-1.3.2/include/cereal/cereal.hpp: In instantiation of ‘ArchiveType& cereal::InputArchive<ArchiveType, Flags>::processImpl(const T&) [with T = NamedType<long unsigned int, main()::Size>; typename cereal::traits::detail::EnableIfHelper<(cereal::traits::has_invalid_input_versioning<T, ArchiveType>::value || ((! cereal::traits::is_input_serializable<T, ArchiveType>::value) && ((!(Flags & cereal::AllowEmptyClassElision)) || ((Flags & cereal::AllowEmptyClassElision) && (! std::is_empty<T>::value)))))>::type <anonymous> = (cereal::traits::detail::sfinae)0; ArchiveType = cereal::JSONInputArchive; unsigned int Flags = 0]’: /ufo/tools/cereal-1.3.2/include/cereal/cereal.hpp:853:26: required from ‘void cereal::InputArchive<ArchiveType, Flags>::process(T&&) [with T = NamedType<long unsigned int, main()::Size>&; ArchiveType = cereal::JSONInputArchive; unsigned int Flags = 0]’ /ufo/tools/cereal-1.3.2/include/cereal/cereal.hpp:730:16: required from ‘ArchiveType& cereal::InputArchive<ArchiveType, Flags>::operator()(Types&& ...) [with Types = {NamedType<long unsigned int, main()::Size>&}; ArchiveType = cereal::JSONInputArchive; unsigned int Flags = 0]’ /tools/cereal-1.3.2/include/cereal/cereal.hpp:985:86: error: static assertion failed: cereal could not find any input serialization functions for the provided type and archive combination. Types must either have a serialize function, load/save pair, or load_minimal/save_minimal pair (you may not mix these). Serialize functions generally have the following signature: template<class Archive> void serialize(Archive & ar) { ar( member1, member2, member3 ); } 985 | static_assert(traits::detail::count_input_serializers<T, ArchiveType>::value != 0,
This is not an issue when serializing with save and load functions.
save
load
The text was updated successfully, but these errors were encountered:
Sorry, something went wrong.
No branches or pull requests
The following is a minimal example which does not compile for me under C++ 17:
The compiler outputs something to the effect of:
This is not an issue when serializing with
save
andload
functions.The text was updated successfully, but these errors were encountered: