You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this awesome book. It's been my go to reference for all things Rcpp. One thing that I think that could be clarified though is the section on logical operators (chapter 11). Coming from an R background, I expected & and | to take and return logical values, but my code wasn't working. After a bit of digging, I learned it was because && and || are the logical operators in C++ while & and | are bitwise (1 is interpreted as TRUE and everything else is interpreted as FALSE).
Most people from an R background would probably be looking for the logical operators so a clarification and a table like this could be useful.
Thanks for this awesome book. It's been my go to reference for all things Rcpp. One thing that I think that could be clarified though is the section on logical operators (chapter 11). Coming from an R background, I expected
&
and|
to take and return logical values, but my code wasn't working. After a bit of digging, I learned it was because&&
and||
are the logical operators in C++ while&
and|
are bitwise (1 is interpreted as TRUE and everything else is interpreted as FALSE).Most people from an R background would probably be looking for the logical operators so a clarification and a table like this could be useful.
!
!x
&&
x && y
||
x || y
Logical Operators in C++ (Source: learnCpp.com)
The text was updated successfully, but these errors were encountered: