MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / interpolate_string

Function interpolate_string

src/include/migraphx/stringutils.hpp:139–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137
138template <class F>
139inline std::string
140interpolate_string(const std::string& input, F f, std::string start = "${", std::string end = "}")
141{
142 std::string result = "";
143 result.reserve(input.size());
144 auto it = input.begin();
145 while(it != input.end())
146 {
147 auto next_start = std::search(it, input.end(), start.begin(), start.end());
148 auto next_end = std::search(next_start, input.end(), end.begin(), end.end());
149 result.append(it, next_start);
150 if(next_start == input.end())
151 break;
152 if(next_end == input.end())
153 {
154 throw std::runtime_error("Unbalanced brackets");
155 }
156 auto r = f(next_start + start.size(), next_end);
157 result.append(r.begin(), r.end());
158 it = next_end + end.size();
159 }
160 return result;
161}
162inline std::string interpolate_string(const std::string& input,
163 const std::unordered_map<std::string, std::string>& vars,
164 std::string start = "${",

Callers 15

TEST_CASEFunction · 0.85
TEST_CASEFunction · 0.85
TEST_CASEFunction · 0.85
generate_point_opMethod · 0.85
generate_make_tensorFunction · 0.85
get_mlir_perf_for_convFunction · 0.85
strMethod · 0.85
generate_reduceFunction · 0.85
compile_opMethod · 0.85
compile_opMethod · 0.85
compile_opMethod · 0.85
compile_opMethod · 0.85

Calls 7

searchFunction · 0.85
trimFunction · 0.85
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
appendMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected