commons 0.1.5
Header-only C++23 library of common/shared types for the C++ libraries
Loading...
Searching...
No Matches
comms::Prioritized Struct Reference

The orderable interface. More...

#include <prioritized.hpp>

Inheritance diagram for comms::Prioritized:

Public Member Functions

virtual int priority () const noexcept
 This object's priority; lower sorts first. Defaults to DEFAULT_PRIORITY.
 

Static Public Attributes

static constexpr int HIGHEST_PRECEDENCE = COMMONS_PRIORITIZED_HIGHEST_PRECEDENCE
 Most-preferred priority (INT_MIN): sorts before everything else.
 
static constexpr int LOWEST_PRECEDENCE = COMMONS_PRIORITIZED_LOWEST_PRECEDENCE
 Least-preferred priority (INT_MAX): sorts after everything else.
 
static constexpr int DEFAULT_PRIORITY = COMMONS_PRIORITIZED_DEFAULT_PRIORITY
 The neutral priority (0) reported when none is set.
 

Detailed Description

The orderable interface.

priority() is virtual with a default rather than pure, so a bare struct Adapter : comms::Prioritized {}; compiles and reports DEFAULT_PRIORITY; the mixin and both WithPriority flavors override it.

Lower value sorts first (higher precedence). The special members are protected to guard against slicing through the interface (mirroring comms::IHasFlags); derived types remain copyable/movable via their own implicitly defined operations.


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