lab_btree
Belligerent BTrees
BTree< K, V >::DataPair Struct Reference

A fancy key-value pair which acts as elements in the BTree. More...

Public Member Functions

 DataPair (K key, V value)
 Constructs a DataPair from the given key and value. More...
 
bool operator< (const DataPair &rhs) const
 Less than operator for a DataPair. More...
 
bool operator< (const K &rhs) const
 Less than operator for a DataPair and a K. More...
 
bool operator> (const DataPair &rhs) const
 Greater than operator for a DataPair. More...
 
bool operator> (const K &rhs) const
 Greater than operator for a DataPair and a K. More...
 
bool operator== (const DataPair &rhs) const
 Equality operator for a DataPair. More...
 
bool operator== (const K &rhs) const
 Equality operator for a DataPair and a K. More...
 

Public Attributes

key
 
value
 

Friends

bool operator< (const K &lhs, const DataPair &rhs)
 Less than operator for a K and a DataPair. More...
 
bool operator> (const K &lhs, const DataPair &rhs)
 Greater than operator for a K and a DataPair. More...
 
bool operator== (const K &lhs, const DataPair &rhs)
 Equality operator for a K and a DataPair. More...
 

Detailed Description

template<class K, class V>
struct BTree< K, V >::DataPair

A fancy key-value pair which acts as elements in the BTree.

Can be compared with <, >, ==. Additionally they can be compared against a K with <, > and == based on its key.

Constructor & Destructor Documentation

◆ DataPair()

template<class K , class V >
BTree< K, V >::DataPair::DataPair ( key,
value 
)
inline

Constructs a DataPair from the given key and value.

Parameters
keyThe key of the pair.
valueThe value of the pair.

Member Function Documentation

◆ operator<() [1/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator< ( const DataPair rhs) const
inline

Less than operator for a DataPair.

The object is less than another if its key is less than the other's key.

Parameters
rhsThe right hand of the < operator.
Returns
true if the object's key is less than rhs' key, false otherwise.

◆ operator<() [2/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator< ( const K &  rhs) const
inline

Less than operator for a DataPair and a K.

Parameters
rhsThe right hand side (K) of the < operator.
Returns
true if the object's key is less than rhs, false otherwise.

◆ operator==() [1/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator== ( const DataPair rhs) const
inline

Equality operator for a DataPair.

One is equal to another if its key is equal to the other's key.

Parameters
rhsThe right hand of the == operator.
Returns
true if the object's key is greater than rhs's key, false otherwise.

◆ operator==() [2/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator== ( const K &  rhs) const
inline

Equality operator for a DataPair and a K.

Parameters
rhsThe right hand side (K) of the == operator.
Returns
true if the object's key is equal to rhs, false otherwise.

◆ operator>() [1/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator> ( const DataPair rhs) const
inline

Greater than operator for a DataPair.

DataPair is greater than another if its key is greater than the other's key.

Parameters
rhsThe right hand of the > operator.
Returns
true if the object's key is greater than rhs's key, false otherwise.

◆ operator>() [2/2]

template<class K , class V >
bool BTree< K, V >::DataPair::operator> ( const K &  rhs) const
inline

Greater than operator for a DataPair and a K.

Parameters
rhsThe right hand side (K) of the > operator.
Returns
true if the object's key is greater than rhs, false otherwise.

Friends And Related Function Documentation

◆ operator<

template<class K , class V >
bool operator< ( const K &  lhs,
const DataPair rhs 
)
friend

Less than operator for a K and a DataPair.

Parameters
lhsThe left hand side (K) of the < operator.
rhsThe right hand side (DataPair) of the < operator.
Returns
true if lhs is less than rhs's key, false otherwise.

◆ operator==

template<class K , class V >
bool operator== ( const K &  lhs,
const DataPair rhs 
)
friend

Equality operator for a K and a DataPair.

Parameters
lhsThe left hand side (K) of the == operator.
rhsThe right hand side (DataPair) of the == operator.
Returns
true if lhs is equal to rhs's key, false otherwise.

◆ operator>

template<class K , class V >
bool operator> ( const K &  lhs,
const DataPair rhs 
)
friend

Greater than operator for a K and a DataPair.

Parameters
lhsThe left hand side (K) of the > operator.
rhsThe right hand side (DataPair) of the > operator.
Returns
true if lhs is greater than rhs's key, false otherwise.

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