Skip to content

Commit

Permalink
Support Vector search for another vector (by value)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikee47 committed Apr 6, 2024
1 parent 00537eb commit 5059948
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/include/FlashString/Vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ template <class ObjectType> class Vector : public Object<Vector<ObjectType>, con
public:
using DataPtrType = const ObjectType* const*;

using Object<Vector<ObjectType>, const ObjectType*>::indexOf;

template <typename ValueType, typename T = ObjectType>
typename std::enable_if<std::is_same<T, String>::value, int>::type indexOf(const ValueType& value,
bool ignoreCase = true) const
Expand Down
4 changes: 4 additions & 0 deletions test/app/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ class VectorTest : public TestGroup
{
Serial << arrayVector << endl;
Serial << _F("arrayVector[") << arrayVector.length() << ']' << endl;

DEFINE_FSTR_ARRAY_LOCAL(vec, float, 1, 2, 3);
int i = arrayVector.indexOf(vec);
REQUIRE_EQ(i, 0);
}

TEST_CASE("Vector<String>")
Expand Down

0 comments on commit 5059948

Please sign in to comment.