% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/40-priority_queue-queue-ops.R
\name{pop_max}
\alias{pop_max}
\title{Pop Maximum-Priority Element}
\usage{
pop_max(x)
}
\arguments{
\item{x}{A \code{priority_queue}.}
}
\value{
A list with fields:
\itemize{
\item \code{value}: removed element, or \code{NULL} when \code{x} is empty.
\item \code{priority}: removed priority, or \code{NULL} when \code{x} is empty.
\item \code{remaining}: queue after removal.
}
}
\description{
Removes one maximum-priority element and returns it with the remaining queue.
}
\details{
Ties are stable: when multiple elements share maximum priority, the earliest
element in queue order is removed.
}
\examples{
x <- priority_queue("a", "b", "c", priorities = c(2, 3, 3))
out <- pop_max(x)
out$value
out$priority
out$remaining
pop_max(priority_queue())
}
