Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upstring_proxy don't know how to compare #191
Comments
|
BTW:
|
|
Similarly, String and string_proxy don't know how to compare: int findString(CharacterVector haystack, String needle) {
for (int i = 0; i < haystack.size(); ++i)
if (haystack[i] == needle)
return i;
return -1;
} |
|
Ok. So I took a look at this and fundamentally something needs to be defined. Specifically what it means for Strings and string_proxy to compare.
So this means that two So, to keep paradigms the same, any comparison between Additionally any comparison between So the question "what does string equality comparison mean?" needs to be answered before this issue can be addressed in a reasonable way. As an aside, for
|
|
This must have gotten fixed during one of the 0.11.* releases. Taking Romain's example from above and putting it into R> sourceCpp("/tmp/foo.cpp")
R> all_equal( c("a", "b"), c("a", "b") )
[1] TRUE
R> so I'll close this. |
|
Note that testing equality of the underlying pointers is not good enough as it fails to handle equal strings that have different encodings. |
I get this because of ambiguities because the
operator==( string_proxy, string_proxy )is not defined.Could have used this in
dplyrhere:https://github.com/hadley/dplyr/blob/5fe733ced5cce12d03787ca2d350b1f75edf95ac/inst/include/dplyr/JoinFactorFactorVisitor_SameLevels.h#L13
instead I had to write the manual loop: