Description
When compiling a standard example from readthedocs,
#include
#include "matplotlibcpp.h"
namespace plt = matplotlibcpp;
int main() {
std::vector x = {1, 2, 3, 4};
std::vector y = {1, 4, 9, 16};
plt::plot(x, y,"r*");
plt::show();
}
on VisualStudio22 with the ISO C++20 flag and native Python 3.10, I get
Apparently, the compiler cannot decide between
// @brief standard plot function supporting the args (x, y, s, keywords) // line 519
// ...
template <typename VectorX, typename VectorY>
bool plot(const VectorX &x, const VectorY &y, const std::string &s = "",
const std::map<std::string, std::string> &keywords = {}) {
return detail::plot_base(detail::_interpreter::get().s_python_function_plot,
x, y, s, keywords);
}
and
// enable plotting of multiple triples (x, y, format) // line 1953
template <typename A, typename B, typename... Args>
bool plot(const A &a, const B &b, const std::string &format, Args... args) {
return plot(a, b, format) && plot(args...);
}
As I understand, correct me if I'm wrong, there a several constructors, each of which is designed to fall through to the first one above, the one that finally calls plot_base. So, I renamed all constructors but the first one above plot1, and my code now successfully calls plt::plot1 ..... Of course, messing with your library and using non-standard calls on my side is not a proper solution. Rename the fall-through constructor, and I haven't even tested similarily overloaded functions?