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
|
@ -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…
Reference in New Issue