@@ -573,6 +573,19 @@ bool Cppyy::AppendTypesSlow(const std::string& name,
573
573
if (name.empty ())
574
574
return true ;
575
575
576
+ auto replace_all = [](std::string& str, const std::string& from, const std::string& to) {
577
+ if (from.empty ())
578
+ return ;
579
+ size_t start_pos = 0 ;
580
+ while ((start_pos = str.find (from, start_pos)) != std::string::npos) {
581
+ str.replace (start_pos, from.length (), to);
582
+ start_pos += to.length ();
583
+ }
584
+ };
585
+
586
+ std::string resolved_name = name;
587
+ replace_all (resolved_name, " std::initializer_list<" , " std::vector<" ); // replace initializer_list with vector
588
+
576
589
// We might have an entire expression such as int, double.
577
590
static unsigned long long struct_count = 0 ;
578
591
std::string code = " template<typename ...T> struct __Cppyy_AppendTypesSlow {};\n " ;
@@ -581,7 +594,7 @@ bool Cppyy::AppendTypesSlow(const std::string& name,
581
594
582
595
std::string var = " __Cppyy_s" + std::to_string (struct_count++);
583
596
// FIXME: We cannot use silent because it erases our error code from Declare!
584
- if (!Cpp::Declare ((" __Cppyy_AppendTypesSlow<" + name + " > " + var +" ;\n " ).c_str (), /* silent=*/ false )) {
597
+ if (!Cpp::Declare ((" __Cppyy_AppendTypesSlow<" + resolved_name + " > " + var +" ;\n " ).c_str (), /* silent=*/ false )) {
585
598
TCppType_t varN = Cpp::GetVariableType (Cpp::GetNamed (var.c_str ()));
586
599
TCppScope_t instance_class = Cpp::GetScopeFromType (varN);
587
600
size_t oldSize = types.size ();
@@ -595,7 +608,7 @@ bool Cppyy::AppendTypesSlow(const std::string& name,
595
608
// We should consider eliminating the `split_comma_saparated_types` and `is_integral`
596
609
// string parsing.
597
610
std::vector<std::string> individual_types;
598
- if (!split_comma_saparated_types (name , individual_types))
611
+ if (!split_comma_saparated_types (resolved_name , individual_types))
599
612
return true ;
600
613
601
614
for (std::string& i : individual_types) {
0 commit comments