mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-06-25 14:06:27 +02:00
Work around MSVC C++20 modules error for nested msgpack::object::with_zone
When packaging msgpack into a C++20 module (by #include of msgpack in the global module fragment and then `export using ...;` for relevant names), MSVC (VS 17.13.5) reports the following: ``` error C2504: 'msgpack::v2::object': base class undefined ``` This is apparently due to with_zone being a nested type of msgpack::object; in order to work around this problem, with_zone is replaced with an alias to a struct defined outside of msgpack::object.
This commit is contained in:
parent
800c483b99
commit
712ec2e383
@ -32,11 +32,11 @@ struct object_kv {
|
|||||||
msgpack::object val;
|
msgpack::object val;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct object::with_zone : msgpack::object {
|
struct object_with_zone_type : msgpack::object {
|
||||||
with_zone(msgpack::zone& z) : zone(z) { }
|
object_with_zone_type(msgpack::zone& z) : zone(z) { }
|
||||||
msgpack::zone& zone;
|
msgpack::zone& zone;
|
||||||
private:
|
private:
|
||||||
with_zone();
|
object_with_zone_type();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
|
|
||||||
#endif // !defined(MSGPACK_USE_CPP03)
|
#endif // !defined(MSGPACK_USE_CPP03)
|
||||||
|
|
||||||
|
struct object_with_zone_type;
|
||||||
|
|
||||||
/// Object class that corresponding to MessagePack format object
|
/// Object class that corresponding to MessagePack format object
|
||||||
/**
|
/**
|
||||||
* See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object
|
* See https://github.com/msgpack/msgpack-c/wiki/v1_1_cpp_object
|
||||||
@ -219,7 +221,8 @@ struct object {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
object& operator=(const T& v);
|
object& operator=(const T& v);
|
||||||
|
|
||||||
struct with_zone;
|
// Not a nested struct (i.e. 'struct with_zone;') to work around MSVC C++20 modules error C2504
|
||||||
|
typedef object_with_zone_type with_zone;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct implicit_type;
|
struct implicit_type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user