mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 03:53:35 +08:00
Field alignment hackery in Map<> that allows to reduce object sizes (see the following commits)
This commit is contained in:
@@ -40,18 +40,19 @@ class UAVCAN_EXPORT MapBase : Noncopyable
|
||||
public:
|
||||
struct KVPair
|
||||
{
|
||||
Value value; // Key and value are swapped because this may allow to reduce padding (depending on types)
|
||||
Key key;
|
||||
Value value;
|
||||
|
||||
KVPair()
|
||||
: key()
|
||||
, value()
|
||||
KVPair() :
|
||||
value(),
|
||||
key()
|
||||
{ }
|
||||
|
||||
KVPair(const Key& arg_key, const Value& arg_value)
|
||||
: key(arg_key)
|
||||
, value(arg_value)
|
||||
KVPair(const Key& arg_key, const Value& arg_value) :
|
||||
value(arg_value),
|
||||
key(arg_key)
|
||||
{ }
|
||||
|
||||
bool match(const Key& rhs) const { return rhs == key; }
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user