Tuesday, December 30, 2008

DOC X

The following chart contains ASCII decimal, octal, hexadecimal and character codes for values from 0 to 127.

Decimal

Octal

Hex

Character

Description

0

0

00

NUL


1

1

01

SOH

start of header

2

2

02

STX

start of text

3

3

03

ETX

end of text

4

4

04

EOT

end of transmission

5

5

05

ENQ

enquiry

6

6

06

ACK

acknowledge

7

7

07

BEL

bell

8

10

08

BS

backspace

9

11

09

HT

horizontal tab

10

12

0A

LF

line feed

11

13

0B

VT

vertical tab

12

14

0C

FF

form feed

13

15

0D

CR

carriage return

14

16

0E

SO

shift out

15

17

0F

SI

shift in

16

20

10

DLE

data link escape

17

21

11

DC1

no assignment, but usually XON

18

22

12

DC2


19

23

13

DC3

no assignment, but usually XOFF

20

24

14

DC4


21

25

15

NAK

negative acknowledge

22

26

16

SYN

synchronous idle

23

27

17

ETB

end of transmission block

24

30

18

CAN

cancel

25

31

19

EM

end of medium

26

32

1A

SUB

substitute

27

33

1B

ESC

escape

28

34

1C

FS

file seperator

29

35

1D

GS

group seperator

30

36

1E

RS

record seperator

31

37

1F

US

unit seperator

32

40

20

SPC

space

33

41

21

!


34

42

22


35

43

23

#


36

44

24

$


37

45

25

%


38

46

26

&


39

47

27


40

50

28

(


41

51

29

)


42

52

2A

*


43

53

2B

+


44

54

2C

,


45

55

2D

-


46

56

2E

.


47

57

2F

/

#, ## manipulate strings #define define variables #error display an error message #if, #ifdef, #ifndef, #else, #elif, #endif conditional operators #include insert the contents of another file #line set line and file information #pragma implementation specific command #undef used to undefine variables Predefined preprocessor variables miscellaneous preprocessor variables

C++ Operator Precedence

The operators at the top of this list are evaluated first.

Precedence

Operator

Description

Example

Associativity

1

::

Scoping operator

Class::age = 2;

none

2

()
[]
->
.
++

Grouping operator
Array access
Member access from a pointer
Member access from an object
Post-increment
Post-decrement

(a + b) / 4;
array[4] = 2;
ptr->age = 34;
obj.age = 34;
for( i = 0; i 0; i– ) …

left to right

3

!
~
++

-
+
*
&
(type)
sizeof

Logical negation
Bitwise complement
Pre-increment
Pre-decrement
Unary minus
Unary plus
Dereference
Address of
Cast to a given type
Return size in bytes

if( !done ) …
flags = ~flags;
for( i = 0; i 0; –i ) …
int i = -1;
int i = +1;
data = *ptr;
address = &obj;
int i = (int) floatNum;
int size = sizeof(floatNum);

right to left

4

->*
.*

Member pointer selector
Member object selector

ptr->*var = 24;
obj.*var = 24;

left to right

5

*
/
%

Multiplication
Division
Modulus

int i = 2 * 4;
float f = 10 / 3;
int rem = 4 % 3;

left to right

6

+
-

Addition
Subtraction

int i = 2 + 3;
int i = 5 - 1;

left to right

7

>

Bitwise shift left
Bitwise shift right

int flags = 33 > 1;

left to right

8


>=

Comparison less-than
Comparison less-than-or-equal-to
Comparison greater-than
Comparison geater-than-or-equal-to

if( i 42 ) …
if( i >= 42 ) …

left to right

9

==
!=

Comparison equal-to
Comparison not-equal-to

if( i == 42 ) …
if( i != 42 ) …

left to right

10

&

Bitwise AND

flags = flags & 42;

left to right

11

^

Bitwise exclusive OR

flags = flags ^ 42;

left to right

12

|

Bitwise inclusive (normal) OR

flags = flags | 42;

left to right

13

&&

Logical AND

if( conditionA && conditionB ) …

left to right

14

||

Logical OR

if( conditionA || conditionB ) …

left to right

15

? :

Ternary conditional (if-then-else)

int i = (a > b) ? a : b;

right to left

16

=
+=
-=
*=
/=
%=
&=
^=
|=
>=

Assignment operator
Increment and assign
Decrement and assign
Multiply and assign
Divide and assign
Modulo and assign
Bitwise AND and assign
Bitwise exclusive OR and assign
Bitwise inclusive (normal) OR and assign
Bitwise shift left and assign
Bitwise shift right and assign

int a = b;
a += 3;
b -= 4;
a *= 5;
a /= 2;
a %= 3;
flags &= new_flags;
flags ^= new_flags;
flags |= new_flags;
flags >= 2;

right to left

17

,

Sequential evaluation operator

for( i = 0, j = 0; i

left to right

One important aspect of C++ that is related to operator precedence is the order of evaluation and the order of side effects in expressions. In some circumstances, the order in which things happen is not defined. For example, consider the following code:

float x = 1;
x = x / ++x;

The value of x is not guaranteed to be consistent across different compilers, because it is not clear whether the computer should evaluate the left or the right side of the division first. Depending on which side is evaluated first, x could take a different value.

Furthermore, while ++x evaluates to x+1, the side effect of actually storing that new value in x could happen at different times, resulting in different values for x.

The bottom line is that expressions like the one above are horribly ambiguous and should be avoided at all costs. When in doubt, break a single ambiguous expression into multiple expressions to ensure that the order of evaluation is correct.

48

60

30

0


49

61

31

1


50

62

32

2


51

63

33

3


52

64

34

4


53

65

35

5


54

66

36

6


55

67

37

7


56

70

38

8


57

71

39

9


58

72

3A

:


59

73

3B

;


60

74

3C



61

75

3D

=


62

76

3E

>


63

77

3F

?


64

100

40

@


65

101

41

A


66

102

42

B


67

103

43

C


68

104

44

D


69

105

45

E


70

106

46

F


71

107

47

G


72

110

48

H


73

111

49

I


74

112

4A

J


75

113

4B

K


76

114

4C

L


77

115

4D

M


78

116

4E

N


79

117

4F

O


80

120

50

P


81

121

51

Q


82

122

52

R


83

123

53

S


84

124

54

T


85

125

55

U


86

126

56

V


87

127

57

W


88

130

58

X


89

131

59

Y


90

132

5A

Z


91

133

5B

[


92

134

5C

\


93

135

5D

]


94

136

5E

^


95

137

5F

_


96

140

60

`


97

141

61

a


98

142

62

b


99

143

63

c


100

144

64

d


101

145

65

e


102

146

66

f


103

147

67

g


104

150

68

h


105

151

69

i


106

152

6A

j


107

153

6B

k


108

154

6C

l


109

155

6D

m


110

156

6E

n


111

157

6F

o


112

160

70

p


113

161

71

q


114

162

72

r


115

163

73

s


116

164

74

t


117

165

75

u


118

166

76

v


119

167

77

w


120

170

78

x


121

171

79

y


122

172

7A

z


123

173

7B

{


124

174

7C

|


125

175

7D

}


126

176

7E

~


127

177

7F

DEL

delete

Escape Sequence Description \’ Single quote \” Double quote \\ Backslash \nnn Octal number (nnn) \0 Null character (really just the octal number zero) \a Audible bell \b Backspace \f Formfeed \n Newline \r Carriage return \t Horizontal tab \v Vertical tab \xnnn Hexadecimal number (nnn)

Type

Description

void

associated with no data type

int

integer

float

floating-point number

double

double precision floating-point number

char

character

C++ defines two more: bool and wchar_t.

Type

Description

bool

Boolean value, true or false

wchar_t

wide character

Type Modifiers

Several of these types can be modified using signed, unsigned, short, and long. When one of these type modifiers is used by itself, a data type of int is assumed. A complete list of possible data types follows:

bool

char

unsigned char

signed char

int

unsigned int

signed int

short int

unsigned short int

signed short int

long int

signed long int

unsigned long int

float

double

long double

wchar_t

Type Sizes and Ranges

The size and range of any data type is compiler and architecture dependent. The “cfloat” (or “float.h”) header file often defines minimum and maximum values for the various data types. You can use the sizeof operator to determine the size of any data type, in bytes. However, many architectures implement data types of a standard size. ints and floats are often 32-bit, chars 8-bit, and doubles are usually 64-bit. bools are often implemented as 8-bit data types.

C/C++ Keywords

Display all entries for C/C++ Keywords on one page, or view entries individually:

asm

insert an assembly instruction

auto

declare a local variable

bool

declare a boolean variable

break

break out of a loop

case

a block of code in a switch statement

catch

handles exceptions from throw

char

declare a character variable

class

declare a class

const

declare immutable data or functions that do not change data

const_cast

cast from const variables

continue

bypass iterations of a loop

default

default handler in a case statement

delete

make memory available

do

looping construct

double

declare a double precision floating-point variable

dynamic_cast

perform runtime casts

else

alternate case for an if statement

enum

create enumeration types

explicit

only use constructors when they exactly match

export

allows template definitions to be separated from their declarations

extern

tell the compiler about variables defined elsewhere

false

the boolean value of false

float

declare a floating-point variable

for

looping construct

friend

grant non-member function access to private data

goto

jump to a different part of the program

if

execute code based off of the result of a test

inline

optimize calls to short functions

int

declare a integer variable

long

declare a long integer variable

mutable

override a const variable

namespace

partition the global namespace by defining a scope

new

allocate dynamic memory for a new variable

operator

create overloaded operator functions

private

declare private members of a class

protected

declare protected members of a class

public

declare public members of a class

register

request that a variable be optimized for speed

reinterpret_cast

change the type of a variable

return

return from a function

short

declare a short integer variable

signed

modify variable type declarations

sizeof

return the size of a variable or type

static

create permanent storage for a variable

static_cast

perform a nonpolymorphic cast

struct

define a new structure

switch

execute code based off of different possible values for a variable

template

create generic functions

this

a pointer to the current object

throw

throws an exception

true

the boolean value of true

try

execute code that can throw an exception

typedef

create a new type name from an existing type

typeid

describes an object

typename

declare a class or undefined type

union

a structure that assigns multiple variables to the same memory location

unsigned

declare an unsigned integer variable

using

import complete or partial namespaces into the current scope

virtual

create a function that can be overridden by a derived class

void

declare functions or data with no associated data type

volatile

warn the compiler about variables that can be modified unexpectedly

wchar_t

declare a wide-character variable

while

looping construct

clearerr clears errors fclose close a file feof true if at the end-of-file ferror checks for a file error fflush writes the contents of the output buffer fgetc get a character from a stream fgetpos get the file position indicator fgets get a string of characters from a stream fopen open a file fprintf print formatted output to a file fputc write a character to a file fputs write a string to a file fread read from a file freopen open an existing stream with a different name fscanf read formatted input from a file fseek move to a specific location in a file fsetpos move to a specific location in a file ftell returns the current file position indicator fwrite write to a file getc read a character from a file getchar read a character from stdin gets read a string from stdin perror displays a string version of the current error to stderr printf write formatted output to stdout putc write a character to a stream putchar write a character to stdout puts write a string to stdout remove erase a file rename rename a file rewind move the file position indicator to the beginning of a file scanf read formatted input from stdin setbuf set the buffer for a specific stream setvbuf set the buffer and size for a specific stream sprintf write formatted output to a buffer sscanf read formatted input from a buffer tmpfile return a pointer to a temporary file tmpnam return a unique filename ungetc puts a character back into a stream vprintf, vfprintf, and vsprintf write formatted output with variable argument lis

Standard C String and Character

Display all entries for Standard C String and Character on one page, or view entries individually:

atof

converts a string to a double

atoi

converts a string to an integer

atol

converts a string to a long

isalnum

true if a character is alphanumeric

isalpha

true if a character is alphabetic

iscntrl

true if a character is a control character

isdigit

true if a character is a digit

isgraph

true if a character is a graphical character

islower

true if a character is lowercase

isprint

true if a character is a printing character

ispunct

true if a character is punctuation

isspace

true if a character is a space character

isupper

true if a character is an uppercase character

isxdigit

true if a character is a hexidecimal character

memchr

searches an array for the first occurance of a character

memcmp

compares two buffers

memcpy

copies one buffer to another

memmove

moves one buffer to another

memset

fills a buffer with a character

strcat

concatenates two strings

strchr

finds the first occurance of a character in a string

strcmp

compares two strings

strcoll

compares two strings in accordance to the current locale

strcpy

copies one string to another

strcspn

searches one string for any characters in another

strerror

returns a text version of a given error code

strlen

returns the length of a given string

strncat

concatenates a certain amount of characters of two strings

strncmp

compares a certain amount of characters of two strings

strncpy

copies a certain amount of characters from one string to another

strpbrk

finds the first location of any character in one string, in another string

strrchr

finds the last occurance of a character in a string

strspn

returns the length of a substring of characters of a string

strstr

finds the first occurance of a substring of characters

strtod

converts a string to a double

strtok

finds the next token in a string

strtol

converts a string to a long

strtoul

converts a string to an unsigned long

strxfrm

converts a substring so that it can be used by string comparison functions

tolower

converts a character to lowercase

toupper

converts a character to uppercase

The library automatically defines a few standard objects:

  • cout, an object of the ostream class, which displays data to the standard output device.
  • cerr, another object of the ostream class that writes unbuffered output to the standard error device.
  • clog, like cerr, but uses buffered output.
  • cin, an object of the istream class that reads data from the standard input device.

The library allows programmers to do file input and output with the ifstream and ofstream classes.

C++ programmers can also do input and output from strings by using the String Stream class.

Some of the behavior of the C++ I/O streams (precision, justification, etc) may be modified by manipulating various io stream format flags.

Here are some examples of what you can do with C++ I/O.

Display all entries for C++ I/O on one page, or view entries individually:

I/O Constructors

constructors

bad

true if an error occurred

clear

clear and set status flags

close

close a stream

eof

true if at the end-of-file

fail

true if an error occurred

fill

manipulate the default fill character

flags

access or manipulate io stream format flags

flush

empty the buffer

gcount

number of characters read during last input

get

read characters

getline

read a line of characters

good

true if no errors have occurred

ignore

read and discard characters

open

open a new stream

peek

check the next input character

precision

manipulate the precision of a stream

put

write characters

putback

return characters to a stream

rdstate

returns the state flags of the stream

read

read data into a buffer

seekg

perform random access on an input stream

seekp

perform random access on output streams

setf

set format flags

sync_with_stdio

synchronize with standard I/O

tellg

read input stream pointers

tellp

read output stream pointers

unsetf

clear io stream format flags

width

access and manipulate the minimum field width

write

write characters

String constructors create strings from arrays of characters and other strings String operators concatenate strings, assign strings, use strings for I/O, compare strings append append characters and strings onto a string assign give a string values from strings of characters and other C++ strings at returns the character at a specific location begin returns an iterator to the beginning of the string c_str returns a non-modifiable standard C character array version of the string capacity returns the number of characters that the string can hold clear removes all characters from the string compare compares two strings copy copies characters from a string into an array data returns a pointer to the first character of a string empty true if the string has no characters end returns an iterator just past the last character of a string erase removes characters from a string find find characters in the string find_first_not_of find first absence of characters find_first_of find first occurrence of characters find_last_not_of find last absence of characters find_last_of find last occurrence of characters getline read data from an I/O stream into a string insert insert characters into a string length returns the length of the string max_size returns the maximum number of characters that the string can hold push_back add a character to the end of the string rbegin returns a reverse_iterator to the end of the string rend returns a reverse_iterator to the beginning of the string replace replace characters in the string reserve sets the minimum capacity of the string resize change the size of the string rfind find the last occurrence of a substring size returns the number of items in the string substr returns a certain substring swap swap the contents of this string

String streams are similar to the and libraries, except that string streams allow you to perform I/O on strings instead of streams. The library provides functionality similar to sscanf() and sprintf() in the standard C library. Three main classes are available in :

  • stringstream - allows input and output
  • istringstream - allows input only
  • ostringstream - allows output only

String streams are actually subclasses of iostreams, so all of the functions available for iostreams are also available for stringstream. See the C++ I/O functions for more information.

Display all entries for C++ String Streams on one page, or view entries individually:

Constructors

create new string streams

Operators

read from and write to string streams

rdbuf

get the buffer for a string stream

str

get or set the stream’s string

Display all entries for Miscellaneous C++ on one page, or view entries individually:

auto_ptr

create pointers that automatically destroy objects

C++ Algorithms

Display all entries for C++ Algorithms on one page, or view entries individually:

accumulate

sum up a range of elements

adjacent_difference

compute the differences between adjacent elements in a range

adjacent_find

finds two items that are adjacent to eachother

binary_search

determine if an element exists in a certain range

copy

copy some range of elements to a new location

copy_backward

copy a range of elements in backwards order

copy_n

copy N elements

count

return the number of elements matching a given value

count_if

return the number of elements for which a predicate is true

equal

determine if two sets of elements are the same

equal_range

search for a range of elements that are all equal to a certain element

fill

assign a range of elements a certain value

fill_n

assign a value to some number of elements

find

find a value in a given range

find_end

find the last sequence of elements in a certain range

find_first_of

search for any one of a set of elements

find_if

find the first element for which a certain predicate is true

for_each

apply a function to a range of elements

generate

saves the result of a function in a range

generate_n

saves the result of N applications of a function

includes

returns true if one set is a subset of another

inner_product

compute the inner product of two ranges of elements

inplace_merge

merge two ordered ranges in-place

is_heap

returns true if a given range is a heap

is_sorted

returns true if a range is sorted in ascending order

iter_swap

swaps the elements pointed to by two iterators

lexicographical_compare

returns true if one range is lexicographically less than another

lexicographical_compare_3way

determines if one range is lexicographically less than or greater than another

lower_bound

search for the first place that a value can be inserted while preserving order

make_heap

creates a heap out of a range of elements

max

returns the larger of two elements

max_element

returns the largest element in a range

merge

merge two sorted ranges

min

returns the smaller of two elements

min_element

returns the smallest element in a range

mismatch

finds the first position where two ranges differ

next_permutation

generates the next greater lexicographic permutation of a range of elements

nth_element

put one element in its sorted location and make sure that no elements to its left are greater than any elements to its right

partial_sort

sort the first N elements of a range

partial_sort_copy

copy and partially sort a range of elements

partial_sum

compute the partial sum of a range of elements

partition

divide a range of elements into two groups

pop_heap

remove the largest element from a heap

prev_permutation

generates the next smaller lexicographic permutation of a range of elements

push_heap

add an element to a heap

random_sample

randomly copy elements from one range to another

random_sample_n

sample N random elements from a range

random_shuffle

randomly re-order elements in some range

remove

remove elements equal to certain value

remove_copy

copy a range of elements omitting those that match a certian value

remove_copy_if

create a copy of a range of elements, omitting any for which a predicate is true

remove_if

remove all elements for which a predicate is true

replace

replace every occurrence of some value in a range with another value

replace_copy

copy a range, replacing certain elements with new ones

replace_copy_if

copy a range of elements, replacing those for which a predicate is true

replace_if

change the values of elements for which a predicate is true

reverse

reverse elements in some range

reverse_copy

create a copy of a range that is reversed

rotate

move the elements in some range to the left by some amount

rotate_copy

copy and rotate a range of elements

search

search for a range of elements

search_n

search for N consecutive copies of an element in some range

set_difference

computes the difference between two sets

set_intersection

computes the intersection of two sets

set_symmetric_difference

computes the symmetric difference between two sets

set_union

computes the union of two sets

sort

sort a range into ascending order

sort_heap

turns a heap into a sorted range of elements

stable_partition

divide elements into two groups while preserving their relative order

stable_sort

sort a range of elements while preserving order between equal elements

swap

swap the values of two objects

swap_ranges

swaps two ranges of elements

transform

applies a function to a range of elements

unique

remove consecutive duplicate elements in a range

unique_copy

create a copy of some range of elements that contains no consecutive duplicates

upper_bound

searches for the last possible location to insert an element into an ordered range

C++ Vectors

Vectors contain contiguous elements stored as an array. Accessing members of a vector or appending elements can be done in constant time, whereas locating a specific value or inserting elements into the vector takes linear time.

Display all entries for C++ Vectors on one page, or view entries individually:

Vector constructors

create vectors and initialize them with some data

Vector operators

compare, assign, and access elements of a vector

assign

assign elements to a vector

at

returns an element at a specific location

back

returns a reference to last element of a vector

begin

returns an iterator to the beginning of the vector

capacity

returns the number of elements that the vector can hold

clear

removes all elements from the vector

empty

true if the vector has no elements

end

returns an iterator just past the last element of a vector

erase

removes elements from a vector

front

returns a reference to the first element of a vector

insert

inserts elements into the vector

max_size

returns the maximum number of elements that the vector can hold

pop_back

removes the last element of a vector

push_back

add an element to the end of the vector

rbegin

returns a reverse_iterator to the end of the vector

rend

returns a reverse_iterator to the beginning of the vector

reserve

sets the minimum capacity of the vector

resize

change the size of the vector

size

returns the number of items in the vector

swap

swap the contents of this vector with another

Double-ended queues are like vectors, except that they allow fast insertions and deletions at the beginning (as well as the end) of the container.

Display all entries for C++ Double-ended Queues on one page, or view entries individually:

Container constructors

create dequeues and initialize them with some data

Container operators

compare, assign, and access elements of a dequeue

assign

assign elements to a dequeue

at

returns an element at a specific location

back

returns a reference to last element of a dequeue

begin

returns an iterator to the beginning of the dequeue

clear

removes all elements from the dequeue

empty

true if the dequeue has no elements

end

returns an iterator just past the last element of a dequeue

erase

removes elements from a dequeue

front

returns a reference to the first element of a dequeue

insert

inserts elements into the dequeue

max_size

returns the maximum number of elements that the dequeue can hold

pop_back

removes the last element of a dequeue

pop_front

removes the first element of the dequeue

push_back

add an element to the end of the dequeue

push_front

add an element to the front of the dequeue

rbegin

returns a reverse_iterator to the end of the dequeue

rend

returns a reverse_iterator to the beginning of the dequeue

resize

change the size of the dequeue

size

returns the number of items in the dequeue

swap

swap the contents of this dequeue with another

Lists are sequences of elements stored in a linked list. Compared to vectors, they allow fast insertions and deletions, but slower random access.

Display all entries for C++ Lists on one page, or view entries individually:

List constructors

create lists and initialize them with some data

List operators

assign and compare lists

assign

assign elements to a list

back

returns a reference to last element of a list

begin

returns an iterator to the beginning of the list

clear

removes all elements from the list

empty

true if the list has no elements

end

returns an iterator just past the last element of a list

erase

removes elements from a list

front

returns a reference to the first element of a list

insert

inserts elements into the list

max_size

returns the maximum number of elements that the list can hold

merge

merge two lists

pop_back

removes the last element of a list

pop_front

removes the first element of the list

push_back

add an element to the end of the list

push_front

add an element to the front of the list

rbegin

returns a reverse_iterator to the end of the list

remove

removes elements from a list

remove_if

removes elements conditionally

rend

returns a reverse_iterator to the beginning of the list

resize

change the size of the list

reverse

reverse the list

size

returns the number of items in the list

sort

sorts a list into ascending order

splice

merge two lists in constant time

swap

swap the contents of this list with another

unique

removes consecutive duplicate elements

C++ Priority Queues

C++ Priority Queues are like queues, but the elements inside the queue are ordered by some predicate.

Display all entries for C++ Priority Queues on one page, or view entries individually:

Priority queue constructors

construct a new priority queue

empty

true if the priority queue has no elements

pop

removes the top element of a priority queue

push

adds an element to the end of the priority queue

size

returns the number of items in the priority queue

top

returns the top element of the priority queue

C++ Queues

The C++ Queue is a container adapter that gives the programmer a FIFO (first-in, first-out) data structure.

Display all entries for C++ Queues on one page, or view entries individually:

Queue constructor

construct a new queue

back

returns a reference to last element of a queue

empty

true if the queue has no elements

front

returns a reference to the first element of a queue

pop

removes the first element of a queue

push

adds an element to the end of the queue

size

returns the number of items in the queue

C++ Stacks

The C++ Stack is a container adapter that gives the programmer the functionality of a stack — specifically, a FILO (first-in, last-out) data structure.

Display all entries for C++ Stacks on one page, or view entries individually:

Stack constructors

construct a new stack

empty

true if the stack has no elements

pop

removes the top element of a stack

push

adds an element to the top of the stack

size

returns the number of items in the stack

top

returns the top element of the stack

C++ Sets

The C++ Set is an associative container that contains a sorted set of unique objects.

Display all entries for C++ Sets on one page, or view entries individually:

Set constructors & destructors

default methods to allocate, copy, and deallocate sets

Set operators

assign and compare sets

begin

returns an iterator to the beginning of the set

clear

removes all elements from the set

count

returns the number of elements matching a certain key

empty

true if the set has no elements

end

returns an iterator just past the last element of a set

equal_range

returns iterators to the first and just past the last elements matching a specific key

erase

removes elements from a set

find

returns an iterator to specific elements

insert

insert items into a set

key_comp

returns the function that compares keys

lower_bound

returns an iterator to the first element greater than or equal to a certain value

max_size

returns the maximum number of elements that the set can hold

rbegin

returns a reverse_iterator to the end of the set

rend

returns a reverse_iterator to the beginning of the set

size

returns the number of items in the set

swap

swap the contents of this set with another

upper_bound

returns an iterator to the first element greater than a certain value

value_comp

returns the function that compares values

C++ Bitsets

C++ Bitsets give the programmer a set of bits as a data structure. Bitsets can be manipulated by various binary operators such as logical AND, OR, and so on.

Display all entries for C++ Bitsets on one page, or view entries individually:

Bitset Constructors

create new bitsets

Bitset Operators

compare and assign bitsets

any

true if any bits are set

count

returns the number of set bits

flip

reverses the bitset

none

true if no bits are set

reset

sets bits to zero

set

sets bits

size

number of bits that the bitset can hold

test

returns the value of a given bit

to_string

string representation of the bitset

to_ulong

returns an integer representation of the bitset

No comments:

Post a Comment