-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathfind.cpp
More file actions
20 lines (17 loc) · 738 Bytes
/
find.cpp
File metadata and controls
20 lines (17 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "find.h"
#include "general_find.h"
bool TRTC_Find(const DVVectorLike& vec, const DeviceViewable& value, size_t& result)
{
Functor src({ {"vec", &vec}, {"value", &value} }, { "id" }, " return vec[id]==value;\n");
return general_find(vec.size(), src, result);
}
bool TRTC_Find_If(const DVVectorLike& vec, const Functor& pred, size_t& result)
{
Functor src({ {"vec", &vec}, {"pred", &pred} }, { "id" }, " return pred(vec[id]);\n");
return general_find(vec.size(), src, result);
}
bool TRTC_Find_If_Not(const DVVectorLike& vec, const Functor& pred, size_t& result)
{
Functor src({ {"vec", &vec}, {"pred", &pred} }, { "id" }, " return !pred(vec[id]);\n");
return general_find(vec.size(), src, result);
}