mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
BLI: fix Vector.prepend declaration
Using `&&` there was a typo. With `&&` the `prepend` method could not be called with a const reference as argument.
This commit is contained in:
parent
ffd1a7d8c8
commit
deb3d566a5
2 changed files with 12 additions and 1 deletions
|
|
@ -637,7 +637,7 @@ class Vector {
|
|||
* Insert values at the beginning of the vector. The has to move all the other elements, so it
|
||||
* has a linear running time.
|
||||
*/
|
||||
void prepend(const T &&value)
|
||||
void prepend(const T &value)
|
||||
{
|
||||
this->insert(0, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -708,6 +708,17 @@ TEST(vector, Prepend)
|
|||
EXPECT_EQ_ARRAY(vec.data(), Span({7, 8, 1, 2, 3}).data(), 5);
|
||||
}
|
||||
|
||||
TEST(vector, PrependString)
|
||||
{
|
||||
std::string s = "test";
|
||||
Vector<std::string> vec;
|
||||
vec.prepend(s);
|
||||
vec.prepend(std::move(s));
|
||||
EXPECT_EQ(vec.size(), 2);
|
||||
EXPECT_EQ(vec[0], "test");
|
||||
EXPECT_EQ(vec[1], "test");
|
||||
}
|
||||
|
||||
TEST(vector, ReverseIterator)
|
||||
{
|
||||
Vector<int> vec = {4, 5, 6, 7};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue