gtopt/position_vector.hpp file

std::vector addressed by ONE strong positional index type

gtopt's positional strong indices (StageIndex, PhaseStageIndex, ScenarioIndex, ...) are implicitly_convertible_to<Index>, so a plain std::vector<T> accepts ANY of them in operator[]: indexing the global stage array with a phase-LOCAL stage position compiled silently (the SimulationLP::prev_stage bug). PositionVector<IndexT, T> is a std::vector<T> (public base: ranges, spans, iteration and size() work unchanged) whose element access

  • accepts its own IndexT,
  • accepts a raw std::size_t (explicit escape hatch, e.g. the result of to_size(idx) or a loop counter),
  • REJECTS every other strong index type at compile time.

Namespaces

namespace gtopt

Classes

template<typename IndexT, typename T>
class gtopt::PositionVector