====== Bit_vector ====== ===== Opis ===== Bit_vector jest to w zasadzie vector, ma ten sam interface co vector. Główną różnicą jest to, że bi_vector jest zoptymalizowany pod względem pamięciowym. Vector zawsze wymaga co najmniej 1 bitu na element, a bit_vector dokładnie jednego bitu na element. __Uwaga!__ Nazwa bit_vector będzie usunięta z przyszłych wersji STL. Przykład: bit_vector V(5); V[0] = true; V[1] = false; V[2] = false; V[3] = true; V[4] = false; for (bit_vector::iterator i = V.begin(); i < V.end(); ++i) cout << (*i ? '1' : '0'); cout << endl; ^Member ^Where defined ^Description^ |value_type |Container |The type of object stored in the bit_vector: bool| |reference |bit_vector |A proxy class that acts as a reference to a single bit. See below for details.| |const_reference |Container |Const reference to value_type. In bit_vector this is simply defined to be bool.| |size_type |Container |An unsigned integral type.| |difference_type |Container |A signed integral type.| |iterator |Container |Iterator used to iterate through a bit_vector.| |const_iterator |Container |Const iterator used to iterate through a bit_vector.| |reverse_iterator |Reversible Container |Iterator used to iterate backwards through a bit_vector.| |const_reverse_iterator |Reversible Container |Const iterator used to iterate backwards through a bit_vector.| |iterator begin() |Container |Returns an iterator pointing to the beginning of the bit_vector.| |iterator end() |Container |Returns an iterator pointing to the end of the bit_vector.| |const_iterator begin() const |Container |Returns a const_iterator pointing to the beginning of the bit_vector.| |const_iterator end() const |Container |Returns a const_iterator pointing to the end of the bit_vector.| |reverse_iterator rbegin() |Reversible Container |Returns a reverse_iterator pointing to the beginning of the reversed bit_vector.| |reverse_iterator rend() |Reversible Container |Returns a reverse_iterator pointing to the end of the reversed bit_vector.| |const_reverse_iterator rbegin() const |Reversible Container |Returns a const_reverse_iterator pointing to the beginning of the reversed bit_vector.| |const_reverse_iterator rend() const |Reversible Container |Returns a const_reverse_iterator pointing to the end of the reversed bit_vector.| |size_type size() const |Container |Returns the number of elements in the bit_vector.| |size_type max_size() const |Container |Returns the largest possible size of the bit_vector.| |size_type capacity() const |bit_vector |See below.| |bool empty() const |Container |true if the bit_vector's size is 0.| |reference operator[](size_type n) |Random Access Container |Returns the n'th element.| |const_reference operator[](size_type n) const |Random Access Container |Returns the n'th element.| |bit_vector() |Container |Creates an empty bit_vector.| |bit_vector(size_type n) |Sequence |Creates a bit_vector with n elements.| |bit_vector(size_type n, bool t) |Sequence |Creates a bit_vector with n copies of t.| |bit_vector(const bit_vector&) |Container |The copy constructor.| |~bit_vector() |Container |The destructor.| |bit_vector& operator=(const bit_vector&) |Container |The assignment operator| |void reserve(size_t) |bit_vector |See below.| |reference front() |Sequence |Returns the first element.| |const_reference front() const |Sequence |Returns the first element.| |reference back() |Back Insertion Sequence |Returns the last element.| |const_reference back() const |Back Insertion Sequence |Returns the last element.| |void push_back(const T&) |Back Insertion Sequence |Inserts a new element at the end.| |void pop_back() |Back Insertion Sequence |Removes the last element.| |void swap(bit_vector&) |Container |Swaps the contents of two bit_vectors.| |void erase(iterator pos) |Sequence |Erases the element at position pos.| |void erase(iterator first, iterator last) |Sequence |Erases the range [first, last)| |void clear() |Sequence |Erases all of the elements.|