#include "tensorstore/util/maybe_hard_constraint.h"
class tensorstore::MaybeHardConstraintIndex;

Combines an Index (which defaults to kImplicit) with a bool indicating whether the value is a hard constraint as opposed to a default value.

This type serves as a base class for option types like ChunkLayout::ChunkElements.

Constructors

explicit MaybeHardConstraintIndex(Index value = kImplicit,
                                  
bool hard_constraint = true);

Constructs from a value.

Conversion operators

constexpr operator Index() const;

Implicitly converts to the Index value.

Methods

bool valid() const;

Checks if the constraint is specified, i.e. value != kImplicit.

Friend functions

friend bool operator==(const MaybeHardConstraintIndexa,
                       
const MaybeHardConstraintIndexb);
friend bool operator!=(const MaybeHardConstraintIndexa,
                       
const MaybeHardConstraintIndexb);

Compares two constraints for equality.

Data members

Index value;

Index value.

bool hard_constraint;

Indicates whether value should be treated as a hard constraint.