mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-05-12 16:19:44 -06:00
rsx/util: Add a simple wrapper for simple_array<T>::for_each
- Just calls std::for_each behind the scenes but it's a lot more convenient
This commit is contained in:
parent
48e2d808c9
commit
278daddd2a
@ -634,5 +634,11 @@ namespace rsx
|
||||
}
|
||||
return accumulate;
|
||||
}
|
||||
|
||||
template <typename F>
|
||||
void for_each(F&& func)
|
||||
{
|
||||
std::for_each(begin(), end(), func);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -378,6 +378,21 @@ namespace rsx
|
||||
}
|
||||
}
|
||||
|
||||
TEST(SimpleArray, ForEach)
|
||||
{
|
||||
rsx::simple_array<int> arr{
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9
|
||||
};
|
||||
arr.for_each(FN(x += 10));
|
||||
|
||||
EXPECT_EQ(arr.size(), 10);
|
||||
|
||||
for (int i = 0; i < 10; ++i)
|
||||
{
|
||||
EXPECT_EQ(arr[i], i + 10);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(AlignedAllocator, Alloc)
|
||||
{
|
||||
auto ptr = rsx::aligned_allocator::malloc<256>(16);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user