Skip to content

Commit

Permalink
3.16.05
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Feb 24, 2020
1 parent b254863 commit 05127ae
Show file tree
Hide file tree
Showing 14 changed files with 222 additions and 78 deletions.
17 changes: 17 additions & 0 deletions doc/EASTL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@
</Expand>
</Type>


<Type Name="eastl::basic_string&lt;wchar_t,*&gt;">
<DisplayString Condition="!!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">{mPair.mFirst.heap.mpBegin,su}</DisplayString>
<DisplayString Condition="!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">{mPair.mFirst.sso.mData,su}</DisplayString>
<Expand>
<Item Name="[length]" Condition="!!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">mPair.mFirst.heap.mnSize</Item>
<Item Name="[capacity]" Condition="!!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">(mPair.mFirst.heap.mnCapacity &amp; ~kHeapMask)</Item>
<Item Name="[value]" Condition="!!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">mPair.mFirst.heap.mpBegin,su</Item>

<Item Name="[length]" Condition="!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize</Item>
<Item Name="[capacity]" Condition="!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">SSOLayout::SSO_CAPACITY</Item>
<Item Name="[value]" Condition="!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)">mPair.mFirst.sso.mData,su</Item>

<Item Name="[uses heap]">!!(mPair.mFirst.sso.mRemainingSizeField.mnRemainingSize &amp; kSSOMask)</Item>
</Expand>
</Type>

<Type Name="eastl::pair&lt;*&gt;">
<DisplayString>({first}, {second})</DisplayString>
<Expand>
Expand Down
12 changes: 9 additions & 3 deletions include/EASTL/allocator_malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,20 @@
#include <stdlib.h> // memalign, posix_memalign.
#define EASTL_ALIGNED_MALLOC_AVAILABLE 1

#if defined(__clang__)
#if __has_include(<malloc/malloc.h>)
#if EA_HAS_INCLUDE_AVAILABLE
#if EA_HAS_INCLUDE(<malloc/malloc.h>)
#include <malloc/malloc.h>
#elif __has_include(<malloc.h>)
#elif EA_HAS_INCLUDE(<malloc.h>)
#include <malloc.h>
#endif
#elif defined(EA_PLATFORM_BSD)
#include <malloc/malloc.h>
#elif defined(EA_COMPILER_CLANG)
#if __has_include(<malloc/malloc.h>)
#include <malloc/malloc.h>
#elif __has_include(<malloc.h>)
#include <malloc.h>
#endif
#else
#include <malloc.h>
#endif
Expand Down
2 changes: 2 additions & 0 deletions include/EASTL/finally.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#endif

#include <EASTL/internal/config.h>
#include <EASTL/internal/move_help.h>
#include <EASTL/type_traits.h>

namespace eastl
{
Expand Down
4 changes: 2 additions & 2 deletions include/EASTL/internal/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@
///////////////////////////////////////////////////////////////////////////////

#ifndef EASTL_VERSION
#define EASTL_VERSION "3.16.01"
#define EASTL_VERSION_N 31601
#define EASTL_VERSION "3.16.05"
#define EASTL_VERSION_N 31605
#endif


Expand Down
22 changes: 13 additions & 9 deletions include/EASTL/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ namespace eastl
/// operator * or ->. autoConstruct is convenient but it causes * and -> to be slightly slower
/// and may result in construction at an inconvenient time.
///
/// The autoDestruct template parameter controls whether the object, if constructed, is automatically
/// destructed when ~late_constructed() is called or must be manually destructed via a call to
/// destruct().
///
/// While construction can be automatic or manual, automatic destruction support is always present.
/// Thus you aren't required in any case to manually call destruct. However, you may safely manually
/// destruct the object at any time before the late_constructed destructor is executed.
Expand Down Expand Up @@ -199,11 +203,11 @@ namespace eastl
/// // You may want to call destruct here, but aren't required to do so unless the Widget type requires it.
/// }
///
template <typename T, bool autoConstruct = true>
template <typename T, bool autoConstruct = true, bool autoDestruct = true>
class late_constructed
{
public:
using this_type = late_constructed<T, autoConstruct>;
using this_type = late_constructed<T, autoConstruct, autoDestruct>;
using value_type = T;
using storage_type = eastl::aligned_storage_t<sizeof(value_type), eastl::alignment_of_v<value_type>>;

Expand All @@ -212,16 +216,16 @@ namespace eastl

~late_constructed()
{
if(mpValue)
if (autoDestruct && mpValue)
(*mpValue).~value_type();
}
}

template <typename... Args>
void construct(Args&&... args)
{
if(!mpValue)
mpValue = new(&mStorage) value_type(eastl::forward<Args>(args)...);
}
mpValue = new (&mStorage) value_type(eastl::forward<Args>(args)...);
}

bool is_constructed() const EA_NOEXCEPT
{ return mpValue != nullptr; }
Expand Down Expand Up @@ -288,11 +292,11 @@ namespace eastl


// Specialization that doesn't auto-construct on demand.
template <typename T>
class late_constructed<T, false> : public late_constructed<T, true>
template <typename T, bool autoDestruct>
class late_constructed<T, false, autoDestruct> : public late_constructed<T, true, autoDestruct>
{
public:
typedef late_constructed<T, true> base_type;
typedef late_constructed<T, true, autoDestruct> base_type;

typename base_type::value_type& operator*() EA_NOEXCEPT
{ EASTL_ASSERT(base_type::mpValue); return *base_type::mpValue; }
Expand Down
36 changes: 19 additions & 17 deletions include/EASTL/string.h
Original file line number Diff line number Diff line change
Expand Up @@ -3900,12 +3900,12 @@ namespace eastl
typedef basic_string<char> string;
typedef basic_string<wchar_t> wstring;

/// string8 / string16 / string32
typedef basic_string<char8_t> string8;
/// custom string8 / string16 / string32
typedef basic_string<char> string8;
typedef basic_string<char16_t> string16;
typedef basic_string<char32_t> string32;

// C++11 string types
/// ISO mandated string types
typedef basic_string<char8_t> u8string; // Actually not a C++11 type, but added for consistency.
typedef basic_string<char16_t> u16string;
typedef basic_string<char32_t> u32string;
Expand Down Expand Up @@ -3934,20 +3934,22 @@ namespace eastl
}
};

#if defined(EA_CHAR8_UNIQUE) && EA_CHAR8_UNIQUE
template <>
struct hash<string8>
{
size_t operator()(const string8& x) const
{
const char8_t* p = (const char8_t*)x.c_str();
unsigned int c, result = 2166136261U;
while((c = *p++) != 0)
result = (result * 16777619) ^ c;
return (size_t)result;
}
};
#endif
// NOTE(rparolin): no longer required.
//
// #if defined(EA_CHAR8_UNIQUE) && EA_CHAR8_UNIQUE
// template <>
// struct hash<string8>
// {
// size_t operator()(const string8& x) const
// {
// const char8_t* p = (const char8_t*)x.c_str();
// unsigned int c, result = 2166136261U;
// while((c = *p++) != 0)
// result = (result * 16777619) ^ c;
// return (size_t)result;
// }
// };
// #endif

template <>
struct hash<string16>
Expand Down
2 changes: 2 additions & 0 deletions include/EASTL/vector_multimap.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ namespace eastl
inline vector_multimap<K, T, C, A, RAC>::vector_multimap()
: base_type(), mValueCompare(C())
{
#if EASTL_NAME_ENABLED
get_allocator().set_name(EASTL_VECTOR_MULTIMAP_DEFAULT_NAME);
#endif
}


Expand Down
2 changes: 1 addition & 1 deletion test/packages/EATest
Submodule EATest updated 1 files
+48 −2 .gitignore
3 changes: 2 additions & 1 deletion test/source/TestFixedVector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ int TestFixedVector()
EATEST_VERIFY(fv88.capacity() >= (capacity * 2));

// void swap(this_type& x);
FixedVectorInt8 fv7(5, 3);
// FixedVectorInt8 fv7(5, 3); // MSVC-ARM64 generated an internal compiler error on this line.
FixedVectorInt8 fv7 = {3, 3, 3, 3, 3};
FixedVectorInt8 fv8(intArray, intArray + 8);

swap(fv7, fv8);
Expand Down
4 changes: 2 additions & 2 deletions test/source/TestMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ int TestMap()

{
// User reports that EASTL_VALIDATE_COMPARE_ENABLED / EASTL_COMPARE_VALIDATE isn't compiling for this case.
eastl::map<eastl::string8, int> m;
m.find_as(EA_CHAR8("some string"), eastl::equal_to_2<eastl::string8, const char8_t*>());
eastl::map<eastl::u8string, int> m;
m.find_as(EA_CHAR8("some string"), eastl::equal_to_2<eastl::u8string, const char8_t*>());
}

{
Expand Down
Loading

0 comments on commit 05127ae

Please sign in to comment.