MinMaxExpression
class MinMaxExpression
Expression representing the minimum or maximum of two sub-expressions: .min(a, b) or .max(a, b).
constructor MinMaxExpression
Create a minimum or maximum expression.
| MinMaxExpression | ( | const Location & location, | |
| Expression a, | |||
| Expression b, | |||
| bool minimum | ); |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the expression in the source code. |
a |
The first sub-expression. |
b |
The second sub-expression. |
minimum |
Whether this is a minimum expression ( |
method createstatic
Create an expression representing the minimum or maximum of two sub-expressions.
This might not create a MinMaxExpression if the operation can be simplified (e.g. if both operands have values).
| static Expression create | ( | const Location & location, | |
| const Expression & a, | |||
| const Expression & b, | |||
| bool minimum | ); |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the expression in the source code. |
a |
The first sub-expression. |
b |
The second sub-expression. |
minimum |
Whether this is a minimum expression ( |
| RETURNS | DESCRIPTION |
|---|---|
Expression |
The created expression. |
method create_maxstatic
Create a maximum expression from arguments.
| static Expression create_max | ( | const Location & location, | |
| const std::vector< Expression > & arguments | ); |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the expression in the source code. |
arguments |
The arguments of the expression. Must contain exactly two expressions. |
| RETURNS | DESCRIPTION |
|---|---|
Expression |
The created expression. |
method create_minstatic
Create a minimum expression from arguments.
| static Expression create_min | ( | const Location & location, | |
| const std::vector< Expression > & arguments | ); |
| PARAMETER | DESCRIPTION |
|---|---|
location |
The location of the expression in the source code. |
arguments |
The arguments of the expression. Must contain exactly two expressions. |
| RETURNS | DESCRIPTION |
|---|---|
Expression |
The created expression. |
method evaluatedconstvirtual
| virtual std::optional< Expression > evaluated | ( | const EvaluationContext & context | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
context |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Expression > |
method maximum_valueconstvirtual
Get the maximum possible value of the expression if it can be determined.
| virtual std::optional< Value > maximum_value | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Value > |
The maximum possible value of the expression. |
method minimum_valueconstvirtual
Get the minimum possible value of the expression if it can be determined.
| virtual std::optional< Value > minimum_value | ( | ) const; |
| RETURNS | DESCRIPTION |
|---|---|
std::optional< Value > |
The minimum possible value of the expression. |
method serialize_subconstvirtual
Serialize the expression to a stream.
This method must be implemented by derived classes.
| virtual void serialize_sub | ( | std::ostream & stream | ) const; |
| PARAMETER | DESCRIPTION |
|---|---|
stream |
The stream to serialize to. |