Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Equivalences and Orderings

Synopsis
Lexicographical Ordering
Sequential Element Ordering
Protonic Equality

Equivalences and Orderings

interval

interval
sets

interval
maps

itl::set

itl::map

Segment Ordering

bool operator == (const T&, const T&)

1

1

1

1

1

bool operator != (const T&, const T&)

1

1

1

1

1

bool operator < (const T&, const T&)

1

1

1

1

1

bool operator > (const T&, const T&)

1

1

1

1

1

bool operator <= (const T&, const T&)

1

1

1

1

1

bool operator >= (const T&, const T&)

1

1

1

1

1

Element Ordering

bool is_element_equal(const T&, const P&)

S

M

1

1

bool is_element_less(const T&, const P&)

S

M

1

1

bool is_element_greater(const T&, const P&)

S

M

1

1

Protonic Equality

bool is_protonic_equal(const T&, const P&)

M

1

All common equality and compare operators are defined for all objects of the itl. For all itl containers equality and compare operators implement lexicographical equality and lexicographical comparison, that depends on the equality of template parameter Compare.

Equality and compare operators are defined for all itl objects but there are no overloads between different types.

Containers of different segmentation are different, even if their elements are the same:

split_interval_set<time> w1, w2; //Pseudocode
w1 = {[Mon       ..       Sun)}; //split_interval_set containing a week
w2 = {[Mon .. Fri)[Sat .. Sun)}; //Same week split in work and week end parts.
w1 == w2;                        //false: Different segmentation
is_element_equal(w1,w2);         //true:  Same elements contained  

Complexity is linear in the iterative_size of the shorter container to compare.

The Sequential Element Ordering abstracts from the way in which elements of interval containers are clustered into intervals: it's segmentation.

So these equality and compare operations can be applied within interval container types. The admissible type combinations are summarized in the next overload table.

// overload tables for
bool is_element_equal  (const T&, const P&)
bool is_element_less   (const T&, const P&)
bool is_element_greater(const T&, const P&)

element containers:     interval containers:  
T\P| s m                T\P| S1 S2 S3 M1 M3    
---+----                ---+---------------    
s  | 1                  S1 | 1  1  1    
m  |   1                S2 | 1  1  1    
                        S3 | 1  1  1
                        M1 |          1  1
                        M3 |          1  1

For element containers lexicographical equality and sequential element equality are identical.

The complexity of sequential element comparison functions is linear in the iterative_size of the larger container.

Protonic Equality is an equality predicate that is available for itl::maps and interval_maps. It yields true, if two maps are sequential element equal except for value pairs whose associated values are neutral elements.

Complexity is linear in the iterative_size of the larger container to compare.

See also . . .

Semantics

Back to section . . .

Function Synopsis

Interface


PrevUpHomeNext