The bitvector class template interface is based on the std::vector<bool> interface. It is an dynamically sized array of bools packed into 1 bit per bool representation. In the default shipping configuration, Metrowerks::bitvector<> and std::vector<bool> provide identical functionality and performance. However clients can use the statement #define _EWL_NO_VECTOR_BOOL which removes the std::vector<bool> specialization, causing std::vector<bool> to behave like any other vector<T>. In this configuration, Metrowerks::bitvector<> remains available and as described herein. This allows clients the opportunity to use both packed and unpacked arrays of bool in the same application.
namespace Metrowerks { template <class Allocator = std::allocator<bool> > class bitvector { public: // types: typedef Allocator allocator_type; typedef typename allocator_type::size_type size_type; typedef typename allocator_type::difference_type difference_type; typedef bool value_type; class reference; class const_reference; class pointer; class const_pointer; class iterator; // random access class const_iterator; // random access typedef std::reverse_iterator<iterator> reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator; explicit bitvector(const allocator_type& a = Allocator()); explicit bitvector(size_type n, bool x = false, const allocator_type& a = Allocator()); template <class InputIterator> bitvector(InputIterator first, InputIterator last, const allocator_type& a = Allocator()); bitvector(const bitvector& x); bitvector& operator=(const bitvector& x); ~bitvector(); size_type size() const; bool empty() const; size_type capacity() const; size_type max_size() const; void reserve(size_type n); allocator_type get_allocator() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; reverse_iterator rbegin(); const_reverse_iterator rbegin() const; reverse_iterator rend(); const_reverse_iterator rend() const; reference front(); const_reference front() const; reference back(); const_reference back() const; reference operator[](size_type n); const_reference operator[](size_type n) const; const_reference at(size_type n) const; reference at(size_type n); void assign(size_type n, bool x); template <class InputIterator> void assign(InputIterator first, InputIterator last); void push_back(bool x); void pop_back(); iterator insert(iterator position, bool x); void insert(iterator position, size_type n, bool x); template <class InputIterator> void insert(iterator position, InputIterator first, InputIterator last); void clear(); iterator erase(iterator position); iterator erase(iterator first, iterator last); void resize(size_type sz, bool c = false); void swap(bitvector& x); void flip(); bool invariants() const; }; template <class Allocator> bool operator==(const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> bool operator!=(const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> bool operator< (const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> bool operator> (const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> bool operator>=(const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> bool operator<=(const bitvector<Allocator>& x, const bitvector<Allocator>& y); template <class Allocator> void swap(bitvector<Allocator>& x, bitvector<Allocator>& y); } // Metrowerks