mirror of https://github.com/stella-emu/stella.git
Add generic 'contains' method, and remove incorrect FIXME.
This commit is contained in:
parent
2a69ba4ed0
commit
b45b997923
|
@ -32,7 +32,6 @@ namespace Common {
|
|||
*/
|
||||
struct Point
|
||||
{
|
||||
// FIXME : make this uInt32
|
||||
Int32 x{0}; //!< The horizontal part of the point
|
||||
Int32 y{0}; //!< The vertical part of the point
|
||||
|
||||
|
|
|
@ -170,10 +170,10 @@ namespace BSPF
|
|||
return (val < lower) ? upper : (val > upper) ? lower : val;
|
||||
}
|
||||
|
||||
// Test whether the vector contains the given value
|
||||
template<typename T>
|
||||
bool contains(const std::vector<T>& v, const T& elem) {
|
||||
return !(v.empty() || std::find(v.begin(), v.end(), elem) == v.end());
|
||||
// Test whether a container contains the given value
|
||||
template<typename Container>
|
||||
bool contains(const Container& c, typename Container::const_reference elem) {
|
||||
return std::find(c.cbegin(), c.cend(), elem) != c.end();
|
||||
}
|
||||
|
||||
// Convert string to given case
|
||||
|
|
|
@ -316,8 +316,7 @@ bool Widget::isWidgetInChain(Widget* w, Widget* find)
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
bool Widget::isWidgetInChain(const WidgetArray& list, Widget* find)
|
||||
{
|
||||
return std::any_of(list.cbegin(), list.cend(),
|
||||
[&](Widget* w) { return w == find; });
|
||||
return BSPF::contains(list, find);
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
|
Loading…
Reference in New Issue