24QuantExt::CompiledFormula
parseFormula(
const std::string& text, std::vector<std::string>& variables) {
26 auto mapping = [&variables](
const std::string& s) {
27 auto it = std::find(variables.begin(), variables.end(), s);
28 if (it != variables.end()) {
29 return QuantExt::CompiledFormula(QuantLib::Size(it - variables.begin()));
31 variables.push_back(s);
32 return QuantExt::CompiledFormula(QuantLib::Size(variables.size() - 1));
35 return parseFormula<QuantExt::CompiledFormula>(text, mapping);
QuantExt::CompiledFormula parseFormula(const std::string &text, std::vector< std::string > &variables)
Serializable Credit Default Swap.