@@ -65,6 +65,7 @@ namespace tetengo::lattice
6565
6666 \param p_key A pointer to a key.
6767 \param p_value A pointer to a value.
68+ \param index_in_step An index in the step.
6869 \param preceding_step An index of a preceding step.
6970 \param p_preceding_edge_costs A pointer to preceding edge costs.
7071 \param best_preceding_node An index of a best preceding node.
@@ -74,13 +75,15 @@ namespace tetengo::lattice
7475 constexpr node (
7576 const input* p_key,
7677 const std::any* p_value,
78+ std::size_t index_in_step,
7779 std::size_t preceding_step,
7880 const std::vector<int >* p_preceding_edge_costs,
7981 std::size_t best_preceding_node,
8082 int node_cost,
8183 int path_cost) :
8284 m_p_key{ p_key },
8385 m_p_value{ p_value },
86+ m_index_in_step{ index_in_step },
8487 m_preceding_step{ preceding_step },
8588 m_p_preceding_edge_costs{ p_preceding_edge_costs },
8689 m_best_preceding_node{ best_preceding_node },
@@ -92,6 +95,7 @@ namespace tetengo::lattice
9295 \brief Creates a node from a vocabulary entry.
9396
9497 \param entry An entry.
98+ \param index_in_step An index in the step.
9599 \param preceding_step An index of a preceding step.
96100 \param p_preceding_edge_costs A pointer to preceding edge costs.
97101 \param best_preceding_node An index of a best preceding node.
@@ -101,12 +105,13 @@ namespace tetengo::lattice
101105 */
102106 constexpr node (
103107 const entry_view& entry,
108+ std::size_t index_in_step,
104109 std::size_t preceding_step,
105110 const std::vector<int >* p_preceding_edge_costs,
106111 std::size_t best_preceding_node,
107112 int path_cost) :
108- node{ entry.p_key (), entry.value (), preceding_step, p_preceding_edge_costs ,
109- best_preceding_node, entry.cost (), path_cost }
113+ node{ entry.p_key (), entry.value (), index_in_step, preceding_step ,
114+ p_preceding_edge_costs, best_preceding_node, entry.cost (), path_cost }
110115 {}
111116
112117
@@ -151,6 +156,15 @@ namespace tetengo::lattice
151156 return *m_p_value;
152157 }
153158
159+ /* !
160+ \brief Returns the index in the step.
161+
162+ \return The index in the step.
163+ */
164+ [[nodiscard]] constexpr std::size_t index_in_step () const
165+ {
166+ return m_index_in_step;
167+ }
154168 /* !
155169 \brief Returns the index of the preceding step.
156170
@@ -218,6 +232,8 @@ namespace tetengo::lattice
218232
219233 const std::any* m_p_value;
220234
235+ std::size_t m_index_in_step;
236+
221237 std::size_t m_preceding_step;
222238
223239 const std::vector<int >* m_p_preceding_edge_costs;
0 commit comments