Advertisement
Guest User

Пошел нахуй модератор

a guest
May 6th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. Стандартом не определено, является ли char знаковым или беззнаковым.
  2. Можешь попробовать вместо std::string использовать std::basic_string<unsigned char> тогда символы будут представлены точно беззнаковыми значениями.
  3. Можешь сделать так:
  4. >> unsigned char uc = static_cast<unsigned char>(s\[i\]);
  5. >> if (arr\[uc\]) { ... }
  6. Насколько я понимаю, исходя из этого:
  7. >> If the destination type is unsigned, the resulting value is the least unsigned integer congruent to the source integer (modulo 2^n where n is the number of bits used to represent the unsigned type). [ Note: In a two’s complement representation, this conversion is conceptual and there is no change in the bit pattern (if there is no truncation)].
  8. преобразования из signed в unsigned тип обязано происходить БЕЗ ОТБРАСЫВАНИЯ знакового бита, если объем памяти занимаемыми исходным значением и переменной-назначением одинаков.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement