home | login | register | DMCA | contacts | help | donate |      

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
А Б В Г Д Е Ж З И Й К Л М Н О П Р С Т У Ф Х Ц Ч Ш Щ Э Ю Я


my bookshelf | genres | recommend | rating of books | rating of authors | reviews | new | форум | collections | читалки | авторам | add
fantasy
space fantasy
fantasy is horrors
heroic
prose
  military
  child
  russian
detective
  action
  child
  ironical
  historical
  political
western
adventure
adventure (child)
child's stories
love
religion
antique
Scientific literature
biography
business
home pets
animals
art
history
computers
linguistics
mathematics
religion
home_garden
sport
technique
publicism
philosophy
chemistry
close

Loading...


New members

These members are not defined in the Assignable, Default Constructible, or Equality Comparable requirements, but are specific to bitset.

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 >()


Members | Standard Template Library Programmer`s Guide | Iterators







Loading...