Skip to content

Commit 49c753c

Browse files
Add version of make_string accepting iterators
This will make using make_string more flexible.
1 parent 39e9fb3 commit 49c753c

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/solvers/refinement/string_builtin_function.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,19 +122,28 @@ optionalt<std::vector<mp_integer>> eval_string(
122122
return result;
123123
}
124124

125-
array_string_exprt
126-
make_string(const std::vector<mp_integer> &array, const array_typet &array_type)
125+
template <typename Iter>
126+
static array_string_exprt make_string(
127+
Iter begin,
128+
Iter end,
129+
const array_typet &array_type)
127130
{
128131
const typet &char_type = array_type.subtype();
129132
array_exprt array_expr(array_type);
130133
const auto &insert = std::back_inserter(array_expr.operands());
131134
std::transform(
132-
array.begin(), array.end(), insert, [&](const mp_integer &i) { // NOLINT
135+
begin, end, insert, [&](const mp_integer &i) {
133136
return from_integer(i, char_type);
134137
});
135138
return to_array_string_expr(array_expr);
136139
}
137140

141+
static array_string_exprt
142+
make_string(const std::vector<mp_integer> &array, const array_typet &array_type)
143+
{
144+
return make_string(array.begin(), array.end(), array_type);
145+
}
146+
138147
std::vector<mp_integer> string_concatenation_builtin_functiont::eval(
139148
const std::vector<mp_integer> &input1_value,
140149
const std::vector<mp_integer> &input2_value,

0 commit comments

Comments
 (0)