Public Types | Public Member Functions | List of all members
ustl::bitset< Size > Class Template Reference

bitset is a fixed-size block of memory with addressable bits. More...

#include <ustl.h>

Public Types

typedef bitset_value_type value_type
 
typedef value_type * pointer
 
typedef const value_type * const_pointer
 
typedef pointer iterator
 
typedef const_pointer const_iterator
 
typedef size_t difference_type
 
typedef size_t size_type
 
typedef const bitset< Size > & rcself_t
 

Public Member Functions

 bitset (value_type v=0)
 
 bitset (const string &buf)
 
void flip (uoff_t n)
 
void reset (void)
 
void clear (void)
 
void set (void)
 
bitset operator~ (void) const
 
size_type size (void) const
 
size_type capacity (void) const
 
bool test (uoff_t n) const
 
bool operator[] (uoff_t n) const
 
const_iterator begin (void) const
 
iterator begin (void)
 
const_iterator end (void) const
 
iterator end (void)
 
value_type to_value (void) const
 Returns the value_type with the equivalent bits. If size() > 1, you'll get only the first BitsInType(value_type) bits.
 
void flip (void)
 Flips all the bits in the set.
 
void set (uoff_t n, bool val=true)
 Sets or clears bit n.
 
void set (uoff_t first, uoff_t DebugArg(last), value_type v)
 
void reset (uoff_t n)
 Clears the bit n.
 
string to_string (void) const
 Returns a string with bits MSB "001101001..." LSB.
 
value_type at (uoff_t n) const
 
value_type at (uoff_t first, uoff_t last) const
 Returns the value in bits first through last.
 
bool any (void) const
 
bool none (void) const
 
size_t count (void) const
 
bool operator== (rcself_t v) const
 
bitset operator& (rcself_t v) const
 
bitset operator| (rcself_t v) const
 
bitset operator^ (rcself_t v) const
 
rcself_t operator&= (rcself_t v)
 
rcself_t operator|= (rcself_t v)
 
rcself_t operator^= (rcself_t v)
 
void read (istream &is)
 
void write (ostream &os) const
 
void text_write (ostringstream &os) const
 
size_t stream_size (void) const
 

Detailed Description

template<size_t Size>
class ustl::bitset< Size >

bitset is a fixed-size block of memory with addressable bits.

Normally used for state flags; allows setting and unsetting of individual bits as well as bitwise operations on the entire set. The interface is most like that of unsigned integers, and is intended to be used as such. If you were using begin() and end() functions in STL's bitset, you would not be able to do the same thing here, because those functions return host type iterators, not bits.


The documentation for this class was generated from the following file:

Generated on Mon Sep 28 2015 17:58:50 for uSTL by Doxygen 1.8.10