Standard Template Library Programmer's Guide
Здесь есть возможность читать онлайн «Standard Template Library Programmer's Guide» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: Программирование, Справочники, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Standard Template Library Programmer's Guide
- Автор:
- Жанр:
- Год:неизвестен
- ISBN:нет данных
- Рейтинг книги:4 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 80
- 1
- 2
- 3
- 4
- 5
Standard Template Library Programmer's Guide: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Standard Template Library Programmer's Guide»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Standard Template Library Programmer's Guide — читать онлайн бесплатно полную книгу (весь текст) целиком
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Standard Template Library Programmer's Guide», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
Member | Description |
---|---|
reference |
A proxy class that acts as a reference to a single bit. It contains an assignment operator, a conversion to bool , an operator~ , and a member function flip . It exists only as a helper class for bitset 's operator[] . That is, it supports the expressions x = b[i] , b[i] = x , b[i] = b[j] , x = ~b[i] , and b[i].flip() . (Where b is a bitset and x is a bool .) |
bitset(unsigned long val) |
Conversion from unsigned long. Constructs a bitset, initializing the first min(N, sizeof(unsigned long) * CHAR_BIT) bits to the corresponding bits in val and all other bits, if any, to zero. |
template explicit bitset(const basic_string& s, size_t pos = 0, size_t n = basic_string::npos) |
Conversion from string. Constructs a bitset, initializing the first M bits to the corresponding characters in s , where M is defined as min(N, min(s.size() – pos, n)) . Note that the highest character position in s , not the lowest, corresponds to the least significant bit. That is, character position pos + M – 1 – i corresponds to bit i . So, for example, bitset(string("1101")) is the same as bitset(13ul) . This function throws out_of_range if pos > s.size() , and invalid_argument if any of the characters used to initialize the bits are anything other than 0 or 1 . |
bitset& operator&=(const bitset&) |
Bitwise and. |
bitset& operator|=(const bitset&) |
Bitwise inclusive or. |
bitset& operator^=(const bitset&) |
Bitwise exclusive or. |
bitset& operator<<=(size_t n) |
Left shift, where bit 0 is considered the least significant bit. Bit i takes on the previous value of bit i – n , or zero if no such bit exists. |
bitset& operator>>=(size_t n) |
Right shift, where bit 0 is considered the least significant bit. Bit i takes on the previous value of bit i + n , or zero if no such bit exists. |
bitset operator<<(size_t n) const |
Returns a copy of *this shifted left by n bits. Note that the expression b << n is equivalent to constructing a temporary copy of b and then using operator<<= . |
bitset operator>>(size_t n) const |
Returns a copy of *this shifted right by n bits. Note that the expression b >> n is equivalent to constructing a temporary copy of b and then using operator>>= . |
bitset& set() |
Sets every bit. |
bitset& flip() |
Flips the value of every bit. |
bitset operator~() const |
Returns a copy of *this with all of its bits flipped. |
bitset& reset() |
Clears every bit. |
bitset& set(size_t n, int val = 1) |
Sets bit n if val is nonzero, and clears bit n if val is zero. Throws out_of_range if n >= N . |
bitset& reset(size_t n) |
Clears bit n . Throws out_of_range if n >= N . |
bitset flip(size_t n) |
Flips bit n . Throws out_of_range if n >= N . |
size_t size() const |
Returns N . |
size_t count() const |
Returns the number of bits that are set. |
bool any() const |
Returns true if any bits are set. |
bool none() const |
Returns true if no bits are set. |
bool test(size_t n) const |
Returns true if bit n is set. Throws out_of_range if n >= N . |
reference operator[](size_t n) |
Returns a reference to bit n . Note that reference is a proxy class with an assignment operator and a conversion to bool , which allows you to use operator[] for assignment. That is, you can write both x = b[n] and b[n] = x . |
bool operator[](size_t n) const |
Returns true if bit n is set. |
unsigned long to_ulong() const |
Returns an unsigned long corresponding to the bits in *this . Throws overflow_error if it is impossible to represent *this as an unsigned long . (That is, if N is larger than the number of bits in an unsigned long and if any of the high-order bits are set. |
template basic_string to_string() const |
Returns a string representation of *this : each character is 1 if the corresponding bit is set, and 0 if it is not. In general, character position i corresponds to bit position N – 1 – i . Note that this member function relies on two language features, member templates and explicit function template argument specification , that are not yet universally available; this member function is disabled for compilers that do not support those features. Note also that the syntax for calling this member function is somewhat cumbersome. To convert a bitset b to an ordinary string, you must write b.template to_string, allocator >() |
bitset operator&(const bitset&, const bitset&) |
Bitwise and of two bitsets. This is a global function, not a member function. Note that the expression b1 & b2 is equivalent to creating a temporary copy of b1 , using operator&= , and returning the temporary copy. |
bitset operator|(const bitset&, const bitset&) |
Bitwise or of two bitsets. This is a global function, not a member function. Note that the expression b1 | b2 is equivalent to creating a temporary copy of b1 , using operator|= , and returning the temporary copy. |
bitset operator^(const bitset&, const bitset&) |
Bitwise exclusive or of two bitsets. This is a global function, not a member function. Note that the expression b1 ^ b2 is equivalent to creating a temporary copy of b1 , using operator^= , and returning the temporary copy. |
template basic_istream& operator>>(basic_istream& is, bitset& x) |
Extract a bitset from an input stream. This function first skips whitespace, then extracts up to N characters from the input stream. It stops either when it has successfully extracted N character, or when extraction fails, or when it sees a character that is something other than 1 (in which case it does not extract that character). It then assigns a value to the bitset in the same way as if it were initializing the bitset from a string. So, for example, if the input stream contains the characters "1100abc" , it will assign the value 12ul to the bitset , and the next character read from the input stream will be a . |
template basic_ostream& operator>>(basic_ostream& os, const bitset& x) |
Output a bitset to an output stream. This function behaves as if it converts the bitset to a string and then writes that string to the output stream. That is, it is equivalent to os << x.template to_string >() |
vector , bit_vector , string
Читать дальшеИнтервал:
Закладка:
Похожие книги на «Standard Template Library Programmer's Guide»
Представляем Вашему вниманию похожие книги на «Standard Template Library Programmer's Guide» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Standard Template Library Programmer's Guide» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.