Clears the user data cache when syncUserData is called.

Adds unit test for the UserData functons.
Changes the char pointer in btHashString to std::string. There were
problems where the object owning the string memory would deallocate the
string, making the btHashString object invalid.
This commit is contained in:
Tigran Gasparian
2018-06-04 15:10:48 +02:00
parent e0667d8579
commit bb72a91080
4 changed files with 259 additions and 2 deletions

View File

@@ -17,12 +17,13 @@ subject to the following restrictions:
#ifndef BT_HASH_MAP_H
#define BT_HASH_MAP_H
#include <string>
#include "btAlignedObjectArray.h"
///very basic hashable string implementation, compatible with btHashMap
struct btHashString
{
const char* m_string;
std::string m_string;
unsigned int m_hash;
SIMD_FORCE_INLINE unsigned int getHash()const
@@ -71,7 +72,7 @@ struct btHashString
bool equals(const btHashString& other) const
{
return (m_string == other.m_string) ||
(0==portableStringCompare(m_string,other.m_string));
(0==portableStringCompare(m_string.c_str(),other.m_string.c_str()));
}