Drake's trivially copyable optimop

This commit is contained in:
Lirusaito
2019-04-11 05:02:43 -04:00
parent 7fc90d3dce
commit c9eac98d53
20 changed files with 52 additions and 65 deletions

View File

@@ -57,10 +57,10 @@ public:
LLUUID();
explicit LLUUID(const char *in_string); // Convert from string.
explicit LLUUID(const std::string& in_string); // Convert from string.
LLUUID(const LLUUID &in);
LLUUID &operator=(const LLUUID &rhs);
LLUUID(const LLUUID &in) = default;
LLUUID &operator=(const LLUUID &rhs) = default;
~LLUUID();
~LLUUID() = default;
//
// MANIPULATORS
@@ -193,24 +193,6 @@ inline BOOL LLUUID::isNull() const
return !memcmp(mData, null.mData, sizeof(mData)); // <alchemy/>
}
// Copy constructor
inline LLUUID::LLUUID(const LLUUID& rhs)
{
memcpy(mData, rhs.mData, sizeof(mData)); // <alchemy/>
}
inline LLUUID::~LLUUID()
{
}
// Assignment
inline LLUUID& LLUUID::operator=(const LLUUID& rhs)
{
memcpy(mData, rhs.mData, sizeof(mData)); // <alchemy/>
return *this;
}
inline LLUUID::LLUUID(const char *in_string)
{
if (!in_string || in_string[0] == 0)
@@ -289,6 +271,8 @@ inline U32 LLUUID::getCRC32() const
// </alchemy>
}
static_assert(std::is_trivially_copyable<LLUUID>{}, "LLUUID must be a trivially copyable type");
typedef std::vector<LLUUID> uuid_vec_t;
typedef boost::unordered_set<LLUUID> uuid_set_t;