Skip to content

Commit

Permalink
3.16.01
Browse files Browse the repository at this point in the history
  • Loading branch information
rparolin committed Dec 14, 2019
1 parent 970c853 commit c386b06
Show file tree
Hide file tree
Showing 30 changed files with 586 additions and 78 deletions.
20 changes: 10 additions & 10 deletions doc/EASTL.natvis
Original file line number Diff line number Diff line change
Expand Up @@ -151,24 +151,24 @@
</Type>

<Type Name="eastl::ListBase&lt;*&gt;">
<DisplayString Condition="mNode.mpNext == &amp;mNode">
<DisplayString Condition="mNodeAllocator.mFirst.mpNext == &amp;mNodeAllocator.mFirst">
[0] {{}}
</DisplayString>
<DisplayString Condition="mNode.mpNext != &amp;mNode &amp;&amp; mNode.mpNext-&gt;mpNext == &amp;mNode">
[1] {{ {((eastl::ListNode&lt;$T1&gt;*)mNode.mpNext)-&gt;mValue} }}
<DisplayString Condition="mNodeAllocator.mFirst.mpNext != &amp;mNodeAllocator.mFirst &amp;&amp; mNodeAllocator.mFirst.mpNext-&gt;mpNext == &amp;mNodeAllocator.mFirst">
[1] {{ {((eastl::ListNode&lt;$T1&gt;*)mNodeAllocator.mFirst.mpNext)-&gt;mValue} }}
</DisplayString>
<DisplayString Condition="mNode.mpNext != &amp;mNode &amp;&amp; mNode.mpNext-&gt;mpNext != &amp;mNode &amp;&amp; mNode.mpNext-&gt;mpNext-&gt;mpNext == &amp;mNode">
<DisplayString Condition="mNodeAllocator.mFirst.mpNext != &amp;mNodeAllocator.mFirst &amp;&amp; mNodeAllocator.mFirst.mpNext-&gt;mpNext != &amp;mNodeAllocator.mFirst &amp;&amp; mNodeAllocator.mFirst.mpNext-&gt;mpNext-&gt;mpNext == &amp;mNodeAllocator.mFirst">
[2]
{{
{((eastl::ListNode&lt;$T1&gt;*)mNode.mpNext)-&gt;mValue},
{((eastl::ListNode&lt;$T1&gt;*)mNode.mpNext-&gt;mpNext)-&gt;mValue}
{((eastl::ListNode&lt;$T1&gt;*)mNodeAllocator.mFirst.mpNext)-&gt;mValue},
{((eastl::ListNode&lt;$T1&gt;*)mNodeAllocator.mFirst.mpNext-&gt;mpNext)-&gt;mValue}
}}
</DisplayString>
<DisplayString Condition="mNode.mpNext != &amp;mNode &amp;&amp; mNode.mpNext-&gt;mpNext != &amp;mNode &amp;&amp; mNode.mpNext-&gt;mpNext-&gt;mpNext != &amp;mNode">
<DisplayString Condition="mNodeAllocator.mFirst.mpNext != &amp;mNodeAllocator.mFirst &amp;&amp; mNodeAllocator.mFirst.mpNext-&gt;mpNext != &amp;mNodeAllocator.mFirst &amp;&amp; mNodeAllocator.mFirst.mpNext-&gt;mpNext-&gt;mpNext != &amp;mNodeAllocator.mFirst">
[?]
{{
{((eastl::ListNode&lt;$T1&gt;*)mNode.mpNext)-&gt;mValue},
{((eastl::ListNode&lt;$T1&gt;*)mNode.mpNext-&gt;mpNext)-&gt;mValue},
{((eastl::ListNode&lt;$T1&gt;*)mNodeAllocator.mFirst.mpNext)-&gt;mValue},
{((eastl::ListNode&lt;$T1&gt;*)mNodeAllocator.mFirst.mpNext-&gt;mpNext)-&gt;mValue},
...
}}
</DisplayString>
Expand All @@ -177,7 +177,7 @@
<DisplayString>Content of lists will repeat indefinitely. Keep that in mind!</DisplayString>
</Synthetic>
<LinkedListItems>
<HeadPointer>mNode.mpNext</HeadPointer>
<HeadPointer>mNodeAllocator.mFirst.mpNext</HeadPointer>
<NextPointer>mpNext</NextPointer>
<ValueNode>((eastl::ListNode&lt;$T1&gt;*)this)-&gt;mValue</ValueNode>
</LinkedListItems>
Expand Down
19 changes: 19 additions & 0 deletions include/EASTL/deque.h
Original file line number Diff line number Diff line change
Expand Up @@ -2651,6 +2651,25 @@ namespace eastl
a.swap(b);
}

///////////////////////////////////////////////////////////////////////
// erase / erase_if
//
// https://en.cppreference.com/w/cpp/container/deque/erase2
///////////////////////////////////////////////////////////////////////
template <class T, class Allocator, class U>
void erase(deque<T, Allocator>& c, const U& value)
{
// Erases all elements that compare equal to value from the container.
c.erase(eastl::remove(c.begin(), c.end(), value), c.end());
}

template <class T, class Allocator, class Predicate>
void erase_if(deque<T, Allocator>& c, Predicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
c.erase(eastl::remove_if(c.begin(), c.end(), predicate), c.end());
}


} // namespace eastl

Expand Down
43 changes: 39 additions & 4 deletions include/EASTL/hash_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,25 @@ namespace eastl

}; // hash_map




/// hash_map erase_if
///
/// https://en.cppreference.com/w/cpp/container/unordered_map/erase_if
template <typename Key, typename T, typename Hash, typename Predicate, typename Allocator, bool bCacheHashCode, typename UserPredicate>
void erase_if(eastl::hash_map<Key, T, Hash, Predicate, Allocator, bCacheHashCode>& c, UserPredicate predicate)
{
// Erases all elements that satisfy the predicate from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}


/// hash_multimap
Expand Down Expand Up @@ -436,9 +452,28 @@ namespace eastl
return base_type::DoInsertKey(false_type(), eastl::move(key));
}


}; // hash_multimap

/// hash_multimap erase_if
///
/// https://en.cppreference.com/w/cpp/container/unordered_multimap/erase_if
template <typename Key, typename T, typename Hash, typename Predicate, typename Allocator, bool bCacheHashCode, typename UserPredicate>
void erase_if(eastl::hash_multimap<Key, T, Hash, Predicate, Allocator, bCacheHashCode>& c, UserPredicate predicate)
{
// Erases all elements that satisfy the predicate from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}



///////////////////////////////////////////////////////////////////////
Expand Down
42 changes: 39 additions & 3 deletions include/EASTL/hash_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,25 @@ namespace eastl

}; // hash_set




/// hash_set erase_if
///
/// https://en.cppreference.com/w/cpp/container/unordered_set/erase_if
template <typename Value, typename Hash, typename Predicate, typename Allocator, bool bCacheHashCode, typename UserPredicate>
void erase_if(eastl::hash_set<Value, Hash, Predicate, Allocator, bCacheHashCode>& c, UserPredicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}


/// hash_multiset
Expand Down Expand Up @@ -321,6 +337,26 @@ namespace eastl

}; // hash_multiset

/// hash_multiset erase_if
///
/// https://en.cppreference.com/w/cpp/container/unordered_multiset/erase_if
template <typename Value, typename Hash, typename Predicate, typename Allocator, bool bCacheHashCode, typename UserPredicate>
void erase_if(eastl::hash_multiset<Value, Hash, Predicate, Allocator, bCacheHashCode>& c, UserPredicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}



///////////////////////////////////////////////////////////////////////
Expand Down
22 changes: 10 additions & 12 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.15.00"
#define EASTL_VERSION_N 31500
#define EASTL_VERSION "3.16.01"
#define EASTL_VERSION_N 31601
#endif


Expand Down Expand Up @@ -143,20 +143,18 @@
// http://en.wikipedia.org/wiki/C%2B%2B14#Relaxed_constexpr_restrictions
//
#if !defined(EA_CPP14_CONSTEXPR)

#if defined(EA_COMPILER_MSVC_2015)
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#elif defined(EA_COMPILER_GNUC) && (EA_COMPILER_VERSION < 9000) // Before GCC 9.0
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#elif defined(EA_COMPILER_CLANG) && (EA_COMPILER_VERSION < 500) // Before clang5
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#elif defined(__GNUC__) && (EA_COMPILER_VERSION < 9000) // Before GCC 9.0
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#elif defined(EA_COMPILER_CPP14_ENABLED)
#define EA_CPP14_CONSTEXPR constexpr
#else
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#define EA_CPP14_CONSTEXPR // not supported
#define EA_NO_CPP14_CONSTEXPR
#endif
#endif

Expand Down
20 changes: 20 additions & 0 deletions include/EASTL/list.h
Original file line number Diff line number Diff line change
Expand Up @@ -2138,6 +2138,26 @@ namespace eastl
}


///////////////////////////////////////////////////////////////////////
// erase / erase_if
//
// https://en.cppreference.com/w/cpp/container/list/erase2
///////////////////////////////////////////////////////////////////////
template <class T, class Allocator, class U>
void erase(list<T, Allocator>& c, const U& value)
{
// Erases all elements that compare equal to value from the container.
c.remove_if([&](auto& elem) { return elem == value; });
}

template <class T, class Allocator, class Predicate>
void erase_if(list<T, Allocator>& c, Predicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
c.remove_if(predicate);
}


} // namespace eastl


Expand Down
42 changes: 41 additions & 1 deletion include/EASTL/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,26 @@ namespace eastl
}



///////////////////////////////////////////////////////////////////////
// erase_if
//
// https://en.cppreference.com/w/cpp/container/map/erase_if
///////////////////////////////////////////////////////////////////////
template <class Key, class T, class Compare, class Allocator, class Predicate>
void erase_if(map<Key, T, Compare, Allocator>& c, Predicate predicate)
{
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}


///////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -633,6 +652,27 @@ namespace eastl



///////////////////////////////////////////////////////////////////////
// erase_if
//
// https://en.cppreference.com/w/cpp/container/multimap/erase_if
///////////////////////////////////////////////////////////////////////
template <class Key, class T, class Compare, class Allocator, class Predicate>
void erase_if(multimap<Key, T, Compare, Allocator>& c, Predicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}

} // namespace eastl

Expand Down
43 changes: 42 additions & 1 deletion include/EASTL/set.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,26 @@ namespace eastl
}



///////////////////////////////////////////////////////////////////////
// erase_if
//
// https://en.cppreference.com/w/cpp/container/set/erase_if
///////////////////////////////////////////////////////////////////////
template <class Key, class Compare, class Allocator, class Predicate>
void erase_if(set<Key, Compare, Allocator>& c, Predicate predicate)
{
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}


///////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -586,6 +605,28 @@ namespace eastl
}


///////////////////////////////////////////////////////////////////////
// erase_if
//
// https://en.cppreference.com/w/cpp/container/multiset/erase_if
///////////////////////////////////////////////////////////////////////
template <class Key, class Compare, class Allocator, class Predicate>
void erase_if(multiset<Key, Compare, Allocator>& c, Predicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
for (auto i = c.begin(), last = c.end(); i != last;)
{
if (predicate(*i))
{
i = c.erase(i);
}
else
{
++i;
}
}
}


} // namespace eastl

Expand Down
18 changes: 18 additions & 0 deletions include/EASTL/slist.h
Original file line number Diff line number Diff line change
Expand Up @@ -1856,6 +1856,24 @@ namespace eastl
}


/// erase / erase_if
///
/// https://en.cppreference.com/w/cpp/container/forward_list/erase2
template <class T, class Allocator, class U>
void erase(slist<T, Allocator>& c, const U& value)
{
// Erases all elements that compare equal to value from the container.
c.remove_if([&](auto& elem) { return elem == value; });
}

template <class T, class Allocator, class Predicate>
void erase_if(slist<T, Allocator>& c, Predicate predicate)
{
// Erases all elements that satisfy the predicate pred from the container.
c.remove_if(predicate);
}


/// insert_iterator
///
/// We borrow a trick from SGI STL here and define an insert_iterator
Expand Down
Loading

0 comments on commit c386b06

Please sign in to comment.