Skip to content

Commit 76974ce

Browse files
Marking argument of fill_in_map_as_vector as const
Also return empty vector for empty map and corrects typo in comments
1 parent 43b8df9 commit 76974ce

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/solvers/refinement/string_refinement.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,12 @@ void fill_in_vector(
189189
/// \param initial_map: map containing the values of already concrete values
190190
/// \return a populated vector with value from initialized
191191
template <typename T>
192-
std::vector<T> fill_in_map_as_vector(std::map<std::size_t, T> &initial_map)
192+
std::vector<T> fill_in_map_as_vector(
193+
const std::map<std::size_t, T> &initial_map)
193194
{
195+
if(initial_map.empty())
196+
return std::vector<T>();
197+
194198
std::size_t last_index=initial_map.rbegin()->first;
195199
std::vector<T> result(last_index+1);
196200
// Pad the concretized values to the left to assign the uninitialized
@@ -200,7 +204,7 @@ std::vector<T> fill_in_map_as_vector(std::map<std::size_t, T> &initial_map)
200204
const std::size_t i=pair->first;
201205
const T value=pair->second;
202206
// We must increment the iterator here instead of in the for loop so that
203-
// we can get the leftmost index_to pad
207+
// we can get the leftmost index to pad
204208
pair++;
205209
const std::size_t leftmost_index_to_pad=
206210
pair!=initial_map.rend()?pair->first:0;

0 commit comments

Comments
 (0)