From 700777a8f1204279fd66c89b3620d617df7174c1 Mon Sep 17 00:00:00 2001 From: Michael Khlopin Date: Fri, 11 Dec 2020 21:03:15 +0300 Subject: [PATCH] Using of qualified eastl functions. --- include/EASTL/algorithm.h | 15 ++++--- include/EASTL/bonus/adaptors.h | 8 ++-- include/EASTL/bonus/tuple_vector.h | 8 ++-- include/EASTL/internal/functional_base.h | 2 +- include/EASTL/internal/hashtable.h | 18 ++++---- include/EASTL/internal/red_black_tree.h | 16 ++++---- include/EASTL/memory.h | 4 +- include/EASTL/optional.h | 2 +- include/EASTL/sort.h | 2 +- include/EASTL/tuple.h | 52 ++++++++++++------------ include/EASTL/variant.h | 48 +++++++++++----------- 11 files changed, 87 insertions(+), 88 deletions(-) diff --git a/include/EASTL/algorithm.h b/include/EASTL/algorithm.h index ff2bf8bb..147ff471 100644 --- a/include/EASTL/algorithm.h +++ b/include/EASTL/algorithm.h @@ -2922,7 +2922,7 @@ namespace eastl if(count <= 0) return first; else if(count == 1) - return find(first, last, value); + return eastl::find(first, last, value); else if(last > first) { RandomAccessIterator lookAhead; @@ -3758,7 +3758,7 @@ namespace eastl { typedef typename eastl::iterator_traits::value_type value_type; - return next_permutation(first, last, eastl::less()); + return eastl::next_permutation(first, last, eastl::less()); } @@ -4061,12 +4061,6 @@ namespace eastl /// /// http://en.cppreference.com/w/cpp/algorithm/clamp /// - template - EA_CONSTEXPR const T& clamp(const T& v, const T& lo, const T& hi) - { - return clamp(v, lo, hi, eastl::less<>()); - } - template EA_CONSTEXPR const T& clamp(const T& v, const T& lo, const T& hi, Compare comp) { @@ -4075,6 +4069,11 @@ namespace eastl comp(v, lo) ? lo : comp(hi, v) ? hi : v; } + template + EA_CONSTEXPR const T& clamp(const T& v, const T& lo, const T& hi) + { + return eastl::clamp(v, lo, hi, eastl::less<>()); + } } // namespace eastl diff --git a/include/EASTL/bonus/adaptors.h b/include/EASTL/bonus/adaptors.h index 7e4cd2a6..4d3e6223 100644 --- a/include/EASTL/bonus/adaptors.h +++ b/include/EASTL/bonus/adaptors.h @@ -60,15 +60,15 @@ namespace eastl }; template - auto begin(const reverse_wrapper& w) -> decltype(rbegin(w.mContainer)) + auto begin(const reverse_wrapper& w) -> decltype(eastl::rbegin(w.mContainer)) { - return rbegin(w.mContainer); + return eastl::rbegin(w.mContainer); } template - auto end(const reverse_wrapper& w) -> decltype(rend(w.mContainer)) + auto end(const reverse_wrapper& w) -> decltype(eastl::rend(w.mContainer)) { - return rend(w.mContainer); + return eastl::rend(w.mContainer); } template diff --git a/include/EASTL/bonus/tuple_vector.h b/include/EASTL/bonus/tuple_vector.h index 3ce09396..7123c57f 100644 --- a/include/EASTL/bonus/tuple_vector.h +++ b/include/EASTL/bonus/tuple_vector.h @@ -728,7 +728,7 @@ class TupleVecImpl, Ts...> : public TupleV { if (newNumElements > oldNumCapacity) { - const size_type newCapacity = max(GetNewCapacity(oldNumCapacity), newNumElements); + const size_type newCapacity = eastl::max(GetNewCapacity(oldNumCapacity), newNumElements); void* ppNewLeaf[sizeof...(Ts)]; pair allocation = TupleRecurser::template DoAllocate( @@ -774,7 +774,7 @@ class TupleVecImpl, Ts...> : public TupleV { if (newNumElements > oldNumCapacity) { - const size_type newCapacity = max(GetNewCapacity(oldNumCapacity), newNumElements); + const size_type newCapacity = eastl::max(GetNewCapacity(oldNumCapacity), newNumElements); void* ppNewLeaf[sizeof...(Ts)]; pair allocation = TupleRecurser::template DoAllocate( @@ -826,7 +826,7 @@ class TupleVecImpl, Ts...> : public TupleV { if (newNumElements > oldNumCapacity) { - const size_type newCapacity = max(GetNewCapacity(oldNumCapacity), newNumElements); + const size_type newCapacity = eastl::max(GetNewCapacity(oldNumCapacity), newNumElements); void* ppNewLeaf[sizeof...(Ts)]; pair allocation = TupleRecurser::template DoAllocate( @@ -880,7 +880,7 @@ class TupleVecImpl, Ts...> : public TupleV { if (newNumElements > oldNumCapacity) { - const size_type newCapacity = max(GetNewCapacity(oldNumCapacity), newNumElements); + const size_type newCapacity = eastl::max(GetNewCapacity(oldNumCapacity), newNumElements); void* ppNewLeaf[sizeof...(Ts)]; pair allocation = TupleRecurser::template DoAllocate( diff --git a/include/EASTL/internal/functional_base.h b/include/EASTL/internal/functional_base.h index 669e5fc3..a7d2dc91 100644 --- a/include/EASTL/internal/functional_base.h +++ b/include/EASTL/internal/functional_base.h @@ -210,7 +210,7 @@ namespace eastl template reference_wrapper::reference_wrapper(T &v) EA_NOEXCEPT - : val(addressof(v)) + : val(eastl::addressof(v)) {} template diff --git a/include/EASTL/internal/hashtable.h b/include/EASTL/internal/hashtable.h index 6dc12cd7..bb6d27eb 100644 --- a/include/EASTL/internal/hashtable.h +++ b/include/EASTL/internal/hashtable.h @@ -2701,8 +2701,8 @@ namespace eastl inline typename hashtable::insert_return_type hashtable::try_emplace(const key_type& key, Args&&... args) { - return DoInsertValue(has_unique_keys_type(), piecewise_construct, forward_as_tuple(key), - forward_as_tuple(eastl::forward(args)...)); + return DoInsertValue(has_unique_keys_type(), piecewise_construct, eastl::forward_as_tuple(key), + eastl::forward_as_tuple(eastl::forward(args)...)); } template ::insert_return_type hashtable::try_emplace(key_type&& key, Args&&... args) { - return DoInsertValue(has_unique_keys_type(), piecewise_construct, forward_as_tuple(eastl::move(key)), - forward_as_tuple(eastl::forward(args)...)); + return DoInsertValue(has_unique_keys_type(), piecewise_construct, eastl::forward_as_tuple(eastl::move(key)), + eastl::forward_as_tuple(eastl::forward(args)...)); } template (args)...))); + value_type(piecewise_construct, eastl::forward_as_tuple(key), eastl::forward_as_tuple(eastl::forward(args)...))); return DoGetResultIterator(has_unique_keys_type(), result); } @@ -2736,8 +2736,8 @@ namespace eastl hashtable::try_emplace(const_iterator, key_type&& key, Args&&... args) { insert_return_type result = - DoInsertValue(has_unique_keys_type(), value_type(piecewise_construct, forward_as_tuple(eastl::move(key)), - forward_as_tuple(eastl::forward(args)...))); + DoInsertValue(has_unique_keys_type(), value_type(piecewise_construct, eastl::forward_as_tuple(eastl::move(key)), + eastl::forward_as_tuple(eastl::forward(args)...))); return DoGetResultIterator(has_unique_keys_type(), result); } @@ -2850,7 +2850,7 @@ namespace eastl auto iter = find(k); if(iter == end()) { - return insert(value_type(piecewise_construct, forward_as_tuple(k), forward_as_tuple(eastl::forward(obj)))); + return insert(value_type(piecewise_construct, eastl::forward_as_tuple(k), eastl::forward_as_tuple(eastl::forward(obj)))); } else { @@ -2868,7 +2868,7 @@ namespace eastl auto iter = find(k); if(iter == end()) { - return insert(value_type(piecewise_construct, forward_as_tuple(eastl::move(k)), forward_as_tuple(eastl::forward(obj)))); + return insert(value_type(piecewise_construct, eastl::forward_as_tuple(eastl::move(k)), eastl::forward_as_tuple(eastl::forward(obj)))); } else { diff --git a/include/EASTL/internal/red_black_tree.h b/include/EASTL/internal/red_black_tree.h index 553bb5c8..7448bd42 100644 --- a/include/EASTL/internal/red_black_tree.h +++ b/include/EASTL/internal/red_black_tree.h @@ -1105,7 +1105,7 @@ namespace eastl inline eastl::pair::iterator, bool> rbtree::try_emplace(const key_type& key, Args&&... args) { - return DoInsertValue(has_unique_keys_type(), piecewise_construct, forward_as_tuple(key), forward_as_tuple(eastl::forward(args)...)); + return DoInsertValue(has_unique_keys_type(), piecewise_construct, eastl::forward_as_tuple(key), eastl::forward_as_tuple(eastl::forward(args)...)); } template @@ -1113,7 +1113,7 @@ namespace eastl inline eastl::pair::iterator, bool> rbtree::try_emplace(key_type&& key, Args&&... args) { - return DoInsertValue(has_unique_keys_type(), piecewise_construct, forward_as_tuple(eastl::move(key)), forward_as_tuple(eastl::forward(args)...)); + return DoInsertValue(has_unique_keys_type(), piecewise_construct, eastl::forward_as_tuple(eastl::move(key)), eastl::forward_as_tuple(eastl::forward(args)...)); } template @@ -1123,7 +1123,7 @@ namespace eastl { return DoInsertValueHint( has_unique_keys_type(), position, - piecewise_construct, forward_as_tuple(key), forward_as_tuple(eastl::forward(args)...)); + piecewise_construct, eastl::forward_as_tuple(key), eastl::forward_as_tuple(eastl::forward(args)...)); } template @@ -1133,7 +1133,7 @@ namespace eastl { return DoInsertValueHint( has_unique_keys_type(), position, - piecewise_construct, forward_as_tuple(eastl::move(key)), forward_as_tuple(eastl::forward(args)...)); + piecewise_construct, eastl::forward_as_tuple(eastl::move(key)), eastl::forward_as_tuple(eastl::forward(args)...)); } @@ -1180,7 +1180,7 @@ namespace eastl if(iter == end()) { - return insert(value_type(piecewise_construct, forward_as_tuple(k), forward_as_tuple(eastl::forward(obj)))); + return insert(value_type(piecewise_construct, eastl::forward_as_tuple(k), eastl::forward_as_tuple(eastl::forward(obj)))); } else { @@ -1198,7 +1198,7 @@ namespace eastl if(iter == end()) { - return insert(value_type(piecewise_construct, forward_as_tuple(eastl::move(k)), forward_as_tuple(eastl::forward(obj)))); + return insert(value_type(piecewise_construct, eastl::forward_as_tuple(eastl::move(k)), eastl::forward_as_tuple(eastl::forward(obj)))); } else { @@ -1216,7 +1216,7 @@ namespace eastl if(iter == end()) { - return insert(hint, value_type(piecewise_construct, forward_as_tuple(k), forward_as_tuple(eastl::forward(obj)))); + return insert(hint, value_type(piecewise_construct, eastl::forward_as_tuple(k), eastl::forward_as_tuple(eastl::forward(obj)))); } else { @@ -1234,7 +1234,7 @@ namespace eastl if(iter == end()) { - return insert(hint, value_type(piecewise_construct, forward_as_tuple(eastl::move(k)), forward_as_tuple(eastl::forward(obj)))); + return insert(hint, value_type(piecewise_construct, eastl::forward_as_tuple(eastl::move(k)), eastl::forward_as_tuple(eastl::forward(obj)))); } else { diff --git a/include/EASTL/memory.h b/include/EASTL/memory.h index d1bdc493..cf24b41a 100644 --- a/include/EASTL/memory.h +++ b/include/EASTL/memory.h @@ -1390,7 +1390,7 @@ namespace eastl inline void destroy(ForwardIterator first, ForwardIterator last) { for (; first != last; ++first) - destroy_at(addressof(*first)); + eastl::destroy_at(eastl::addressof(*first)); } @@ -1404,7 +1404,7 @@ namespace eastl ForwardIterator destroy_n(ForwardIterator first, Size n) { for (; n > 0; ++first, --n) - destroy_at(addressof(*first)); + eastl::destroy_at(eastl::addressof(*first)); return first; } diff --git a/include/EASTL/optional.h b/include/EASTL/optional.h index e967f985..763bfd88 100644 --- a/include/EASTL/optional.h +++ b/include/EASTL/optional.h @@ -111,7 +111,7 @@ namespace eastl inline explicit optional_storage(in_place_t, Args&&... args) : engaged(true) { - ::new (eastl::addressof(val)) T{std::forward(args)...}; + ::new (eastl::addressof(val)) T{eastl::forward(args)...}; } template (first, last, compare) - first; + lastSortedEnd = eastl::is_sorted_until(first, last, compare) - first; } // Sort the region unless lastSortedEnd indicates it is already sorted. diff --git a/include/EASTL/tuple.h b/include/EASTL/tuple.h index f9611e21..09f1d633 100644 --- a/include/EASTL/tuple.h +++ b/include/EASTL/tuple.h @@ -199,11 +199,11 @@ namespace Internal // We shouldn't need this explicit constructor as it should be handled by the template below but OSX clang // is_constructible type trait incorrectly gives false for is_constructible::value - explicit TupleLeaf(ValueType&& v) : mValue(move(v)) {} + explicit TupleLeaf(ValueType&& v) : mValue(eastl::move(v)) {} template ::value>::type> explicit TupleLeaf(T&& t) - : mValue(forward(t)) + : mValue(eastl::forward(t)) { } @@ -216,7 +216,7 @@ namespace Internal template TupleLeaf& operator=(T&& t) { - mValue = forward(t); + mValue = eastl::forward(t); return *this; } @@ -243,7 +243,7 @@ namespace Internal template ::value>::type> explicit TupleLeaf(T&& t) - : mValue(forward(t)) + : mValue(eastl::forward(t)) { } @@ -260,7 +260,7 @@ namespace Internal template TupleLeaf& operator=(T&& t) { - mValue = forward(t); + mValue = eastl::forward(t); return *this; } @@ -288,7 +288,7 @@ namespace Internal template ::value>::type> explicit TupleLeaf(T&& t) - : ValueType(forward(t)) + : ValueType(eastl::forward(t)) { } @@ -301,7 +301,7 @@ namespace Internal template TupleLeaf& operator=(T&& t) { - ValueType::operator=(forward(t)); + ValueType::operator=(eastl::forward(t)); return *this; } @@ -381,13 +381,13 @@ namespace Internal // template explicit TupleImpl(integer_sequence, TupleTypes, ValueTypes&&... values) - : TupleLeaf(forward(values))... + : TupleLeaf(eastl::forward(values))... { } template TupleImpl(OtherTuple&& t) - : TupleLeaf(forward>>(get(t)))... + : TupleLeaf(eastl::forward>>(get(t)))... { } @@ -395,7 +395,7 @@ namespace Internal TupleImpl& operator=(OtherTuple&& t) { swallow(TupleLeaf::operator=( - forward>>(get(t)))...); + eastl::forward>>(get(t)))...); return *this; } @@ -664,7 +664,7 @@ namespace Internal template static inline ResultType DoCat2(Tuple1&& t1, Tuple2&& t2) { - return ResultType(get(forward(t1))..., get(forward(t2))...); + return ResultType(get(eastl::forward(t1))..., get(eastl::forward(t2))...); } }; @@ -683,7 +683,7 @@ namespace Internal template static inline ResultType DoCat2(Tuple1&& t1, Tuple2&& t2) { - return TCI::DoCat2(forward(t1), forward(t2)); + return TCI::DoCat2(eastl::forward(t1), eastl::forward(t2)); } }; @@ -701,8 +701,8 @@ namespace Internal static inline ResultType DoCat(TupleArg1&& t1, TupleArg2&& t2, TupleArgsRest&&... ts) { return TupleCat::DoCat( - TupleCat2::DoCat2(forward(t1), forward(t2)), - forward(ts)...); + TupleCat2::DoCat2(eastl::forward(t1), eastl::forward(t2)), + eastl::forward(ts)...); } }; @@ -715,7 +715,7 @@ namespace Internal template static inline ResultType DoCat(TupleArg1&& t1, TupleArg2&& t2) { - return TC2::DoCat2(forward(t1), forward(t2)); + return TC2::DoCat2(eastl::forward(t1), eastl::forward(t2)); } }; } // namespace Internal @@ -755,23 +755,23 @@ class tuple template = 0> EA_CONSTEXPR tuple(U&& u, Us&&... us) - : mImpl(make_index_sequence{}, Internal::MakeTupleTypes_t{}, forward(u), - forward(us)...) + : mImpl(make_index_sequence{}, Internal::MakeTupleTypes_t{}, eastl::forward(u), + eastl::forward(us)...) { } template = 0> explicit EA_CONSTEXPR tuple(U&& u, Us&&... us) - : mImpl(make_index_sequence{}, Internal::MakeTupleTypes_t{}, forward(u), - forward(us)...) + : mImpl(make_index_sequence{}, Internal::MakeTupleTypes_t{}, eastl::forward(u), + eastl::forward(us)...) { } template ::value, bool>::type = false> tuple(OtherTuple&& t) - : mImpl(forward(t)) + : mImpl(eastl::forward(t)) { } @@ -779,7 +779,7 @@ class tuple typename enable_if::value, bool>::type = false> tuple& operator=(OtherTuple&& t) { - mImpl.operator=(forward(t)); + mImpl.operator=(eastl::forward(t)); return *this; } @@ -886,7 +886,7 @@ template inline bool operator>=(const tuple inline typename Internal::TupleCat::ResultType tuple_cat(Tuples&&... ts) { - return Internal::TupleCat::DoCat(forward(ts)...); + return Internal::TupleCat::DoCat(eastl::forward(ts)...); } @@ -896,7 +896,7 @@ inline typename Internal::TupleCat::ResultType tuple_cat(Tuples&&... template inline EA_CONSTEXPR tuple...> make_tuple(Ts&&... values) { - return tuple...>(forward(values)...); + return tuple...>(eastl::forward(values)...); } @@ -906,7 +906,7 @@ inline EA_CONSTEXPR tuple...> make_tuple(Ts&&... template inline EA_CONSTEXPR tuple forward_as_tuple(Ts&&... ts) EA_NOEXCEPT { - return tuple(forward(ts)...); + return tuple(eastl::forward(ts)...); } @@ -957,14 +957,14 @@ namespace detail template EA_CONSTEXPR decltype(auto) apply_impl(F&& f, Tuple&& t, index_sequence) { - return invoke(forward(f), get(forward(t))...); + return invoke(eastl::forward(f), get(eastl::forward(t))...); } } // namespace detail template EA_CONSTEXPR decltype(auto) apply(F&& f, Tuple&& t) { - return detail::apply_impl(forward(f), forward(t), + return detail::apply_impl(eastl::forward(f), eastl::forward(t), make_index_sequence>>{}); } diff --git a/include/EASTL/variant.h b/include/EASTL/variant.h index 3dc55e7f..ed7fc8e3 100644 --- a/include/EASTL/variant.h +++ b/include/EASTL/variant.h @@ -727,7 +727,7 @@ namespace eastl class... Args, class = enable_if_t, is_constructible>, T>> EA_CPP14_CONSTEXPR explicit variant(in_place_type_t, Args&&... args) - : variant(in_place>, forward(args)...) + : variant(in_place>, eastl::forward(args)...) {} template < @@ -736,7 +736,7 @@ namespace eastl class... Args, class = enable_if_t, is_constructible>, T>> EA_CPP14_CONSTEXPR explicit variant(in_place_type_t, std::initializer_list il, Args&&... args) - : variant(in_place>, il, forward(args)...) + : variant(in_place>, il, eastl::forward(args)...) {} template , Args&&... args) : mIndex(I) { - mStorage.template set_as>(forward(args)...); + mStorage.template set_as>(eastl::forward(args)...); } template , std::initializer_list il, Args&&... args) : mIndex(I) { - mStorage.template set_as>(il, forward(args)...); + mStorage.template set_as>(il, eastl::forward(args)...); } @@ -984,11 +984,11 @@ namespace eastl // all of the previous arguments. Then call the next visitor_caller with the new argument added, // and the current variant removed. return visitor_caller::call( - forward(visitor), + eastl::forward(visitor), index_sequence(), index_sequence(), - make_tuple(get(forward(args))..., get(forward(variant))), - forward(variants)... + eastl::make_tuple(get(eastl::forward(args))..., get(eastl::forward(variant))), + eastl::forward(variants)... ); } @@ -1003,12 +1003,12 @@ namespace eastl { // Deduce the type of the inner array of call_next functions using return_type = decltype(call_next<0>( - forward(visitor), + eastl::forward(visitor), index_sequence(), index_sequence(), - forward(args), - forward(variant), - forward(variants)...) + eastl::forward(args), + eastl::forward(variant), + eastl::forward(variants)...) ); using next_type = return_type (*)( @@ -1026,12 +1026,12 @@ namespace eastl // call_next() with the correct index for the variant. return next[variant.index()]( - forward(visitor), + eastl::forward(visitor), index_sequence(), index_sequence(), - forward(args), - forward(variant), - forward(variants)... + eastl::forward(args), + eastl::forward(variant), + eastl::forward(variants)... ); } }; @@ -1045,9 +1045,9 @@ namespace eastl static decltype(auto) EA_CONSTEXPR invoke_visitor(Visitor&& visitor, index_sequence, ArgsTuple&& args, Variant&& variant) { return static_cast(invoke( - forward(visitor), - get(forward(args))..., - get(forward(variant)) + eastl::forward(visitor), + get(eastl::forward(args))..., + get(eastl::forward(variant)) )); } @@ -1087,11 +1087,11 @@ namespace eastl // where N = variant_size EA_CPP14_CONSTEXPR caller_type callers[] = { invoke_visitor... }; - return callers[forward(variant).index()]( - forward(visitor), + return callers[eastl::forward(variant).index()]( + eastl::forward(visitor), index_sequence(), - forward(args), - forward(variant) + eastl::forward(args), + eastl::forward(variant) ); } }; @@ -1123,11 +1123,11 @@ namespace eastl "all variants passed to eastl::visit() must have the same type"); return visitor_caller::call( - forward(visitor), + eastl::forward(visitor), index_sequence<>(), make_index_sequence>(), tuple<>(), - forward(variants)... + eastl::forward(variants)... ); }