Skip to content

Commit

Permalink
Fix special character handling for Windows build: it's may building o…
Browse files Browse the repository at this point in the history
…n msvc, but need to check.
  • Loading branch information
yvonwin committed Apr 11, 2024
1 parent 38df647 commit f525098
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tiktoken.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@ class tiktoken {
}

if (allowed_special.count(special) == 1) {
// return { std::move(special), re2::StringPiece(start, input.begin() - start - special.size()) }; // work fine but faild build msvc
return { std::forward<decltype(special)>(special), re2::StringPiece(start, input.begin() - start - special.size()) }; // need to check msvc build./
#if ! defined(_WIN32)
return { std::move(special), re2::StringPiece(start, input.begin() - start - special.size()) }; // failed on windows building
#else
return { std::move(special), re2::StringPiece(input.data(), input.begin() - start - special.size()) }; // TODO test msvc use
#endif
}
}

Expand Down

0 comments on commit f525098

Please sign in to comment.