mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 15:15:50 +08:00
Fixed buggy CSequence::sortBy when sorting by multiple members.
Implementation of Predicates::MemberLess was wrong, so replaced it with a simpler one. Also added a regression test and removed unused code.
This commit is contained in:
committed by
Klaus Basan
parent
f2bd767c63
commit
8a058202ed
@@ -144,17 +144,6 @@ namespace BlackMisc
|
||||
|
||||
namespace Private
|
||||
{
|
||||
//! \private
|
||||
template <typename T, typename F, size_t... Is>
|
||||
void tupleForEachImpl(T &&tuple, F &&visitor, std::index_sequence<Is...>)
|
||||
{
|
||||
// parameter pack swallow idiom
|
||||
static_cast<void>(std::initializer_list<int>
|
||||
{
|
||||
//! \fixme C-style cast is needed due to a clang bug: https://bugs.llvm.org/show_bug.cgi?id=39375
|
||||
((void)(std::forward<F>(visitor)(std::get<Is>(std::forward<T>(tuple)))), 0)...
|
||||
});
|
||||
}
|
||||
//! \private
|
||||
template <typename T, typename F, size_t... Is>
|
||||
void tupleForEachPairImpl(T &&tuple, F &&visitor, std::index_sequence<Is...>)
|
||||
@@ -168,16 +157,6 @@ namespace BlackMisc
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Invoke a visitor function on each element of a tuple in order.
|
||||
*/
|
||||
template <typename T, typename F>
|
||||
void tupleForEach(T &&tuple, F &&visitor)
|
||||
{
|
||||
using seq = std::make_index_sequence<std::tuple_size<std::decay_t<T>>::value>;
|
||||
return Private::tupleForEachImpl(std::forward<T>(tuple), std::forward<F>(visitor), seq());
|
||||
}
|
||||
|
||||
/*!
|
||||
* Invoke a visitor function on each pair of elements of a tuple in order.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user