mirror of
https://github.com/verilator/verilator.git
synced 2025-01-03 21:27:35 +00:00
Fix C++11 compiler error with C++14 rbegin
This commit is contained in:
parent
d42f76c346
commit
a06f260f42
@ -1085,14 +1085,18 @@ public:
|
||||
return with_func(0, a) < with_func(0, b);
|
||||
});
|
||||
}
|
||||
void rsort() { std::sort(std::rbegin(m_storage), std::rend(m_storage)); }
|
||||
// std::rbegin/std::rend not available until C++14
|
||||
void rsort() {
|
||||
std::sort(std::begin(m_storage), std::end(m_storage), std::greater<T_Value>());
|
||||
}
|
||||
template <typename Func>
|
||||
void rsort(Func with_func) {
|
||||
// with_func returns arbitrary type to use for the sort comparison
|
||||
std::sort(std::rbegin(m_storage), std::rend(m_storage),
|
||||
// std::rbegin/std::rend not available until C++14, so using > below
|
||||
std::sort(std::begin(m_storage), std::end(m_storage),
|
||||
[=](const T_Value& a, const T_Value& b) {
|
||||
// index number is meaningless with sort, as it changes
|
||||
return with_func(0, a) < with_func(0, b);
|
||||
return with_func(0, a) > with_func(0, b);
|
||||
});
|
||||
}
|
||||
void reverse() { std::reverse(std::begin(m_storage), std::end(m_storage)); }
|
||||
|
Loading…
Reference in New Issue
Block a user