我有一个单词列表,我的目标是在一个非常长的短语中匹配每个单词。我在匹配每个单词时没有问题,我唯一的问题是返回包含有关每个匹配信息的结构向量。
在代码中:
typedef struct {
int A, B, C; } Match;
__global__ void Find(veryLongPhrase * _phrase, Words * _word_list, vector<Match> * _matches)
{
int a, b, c;
[...] //Parallel search for each word in the phrase
if(match) //When an occurrence is found
{
_matches.push_back(new Match{ A = a, B = b, C = c }); //Here comes the unknown, what should I do here???
}
}
main()
{
[...]
veryLongPhrase * myPhrase = "The quick brown fox jumps over the …Run Code Online (Sandbox Code Playgroud)