Open ChrisThrasher opened 1 year ago
This means you cannot use something like a const std::vector
and call .data()
Is this a specific case for you? If so, why not just use the regular PlotLine with const T*?
Because I need PlotLineG because my data is in a struct that must be unpacked via a getter function. My vector of structures must be kept non-const just for the sake this API which feels like a bug to me.
https://github.com/epezent/implot/blob/cc5e1daa5c7f2335a9460ae79c829011dc5cef2d/implot.h#L856
The signature for
ImPlot::PlotLineG
uses avoid*
which implies that the data it is reading is mutable. This means you cannot use something like aconst std::vector<double>
and call.data()
to get a pointer to the first element since aconst double*
is not implicitly convertible to avoid*
. I'd like this to be changed to aconst void*
which implies a slight change to the signature ofImPlotGetter
to reflect this extraconst
.This would not be an API break except for those who are using
PlotLineG
to mutate data while ImPlot is reading it.If accepted, I'm willing to help implement this. There are other APIs that behave similarly that ought to receive this same treatment so the PR would touch more interfaces than simply
PlotLineG
.