C++ Portable Types Library (PTypes) Version 1.8


Top: Basic types: cset: Operators

#include <ptypes.h>

// assignment
cset& cset::operator= (const cset& s);

// union
cset& cset::operator+= (const cset& s);
cset& cset::operator+= (char b);
cset  cset::operator+  (const cset& s) const;
cset  cset::operator+  (char b) const;
friend cset operator+  (char b, const cset& s);

// difference
cset& cset::operator-= (const cset& s);
cset& cset::operator-= (char b);
cset  cset::operator-  (const cset& s) const;
cset  cset::operator-  (char b) const;

// intersection
cset& cset::operator*= (const cset& s);
cset  cset::operator*  (const cset& s) const;

// comparison
bool  cset::operator== (const cset& s) const;
bool  cset::operator!= (const cset& s) const;
bool  cset::operator<= (const cset& s) const;
bool  cset::operator>= (const cset& s) const;

// membership
friend bool operator& (char b, const cset& s);

The following rules apply to +, –, and *:

The following rules apply to comparison operations <=, >=, ==, !=:

For an ordinal O and a set S, O & S is true just in case O is a member of S. Unlike the Pascal language, where membership operator is in, PTypes uses ampersand "&" as a membership test operator.

Note: regardless of whether default char is signed or unsigned (usually set through compiler options) cset always treats char arguments as unsigned. This means, if the value of an argument is -1, e.g. in call to operator & or operator +, the value will be converted to 255, -2 will be treated as 254, etc.

See also: Constructors, Manipulation


PTypes home