GraphLib
Bearbeitung der Aufgabe Mini Graph Library für OOP WiSe 2023/24
Loading...
Searching...
No Matches
GraphLib::Internal::PriorityPair< P, T > Struct Template Reference

A pair combining a priority and a value, supporting comparison by priority. More...

#include <util.h>

Public Member Functions

 PriorityPair (P priority, T value)
 Constructs a PriorityPair with given priority and value.
bool operator> (const PriorityPair &right) const
 Greater-than operator comparing by priority.

Public Attributes

priority
 The priority value used for ordering.
value
 The associated value.

Detailed Description

template<typename P, typename T>
struct GraphLib::Internal::PriorityPair< P, T >

A pair combining a priority and a value, supporting comparison by priority.

This utility struct is useful in priority queues or other data structures where elements need to be ordered by a priority key.

Template Parameters
PType of the priority; should support comparison operators.
TType of the stored value.

Definition at line 23 of file util.h.

Constructor & Destructor Documentation

◆ PriorityPair()

template<typename P, typename T>
GraphLib::Internal::PriorityPair< P, T >::PriorityPair ( P priority,
T value )
inlineexplicit

Constructs a PriorityPair with given priority and value.

Parameters
priorityThe priority associated with the value.
valueThe value stored in the pair.

Definition at line 33 of file util.h.

Member Function Documentation

◆ operator>()

template<typename P, typename T>
bool GraphLib::Internal::PriorityPair< P, T >::operator> ( const PriorityPair< P, T > & right) const
inline

Greater-than operator comparing by priority.

Enables sorting PriorityPairs by their priority in descending order.

Parameters
rightThe other PriorityPair to compare against.
Returns
true if this pair's priority is greater than right's priority.

Definition at line 43 of file util.h.

Member Data Documentation

◆ priority

template<typename P, typename T>
P GraphLib::Internal::PriorityPair< P, T >::priority

The priority value used for ordering.

Definition at line 24 of file util.h.

◆ value

template<typename P, typename T>
T GraphLib::Internal::PriorityPair< P, T >::value

The associated value.

Definition at line 25 of file util.h.


The documentation for this struct was generated from the following file:
  • include/GraphLib/internal/util.h