Skip to content

Commit 08113f2

Browse files
author
Benno Evers
committed
Switch to two-phase lookup
1 parent 61880f7 commit 08113f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

matplotlibcpp.h

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,19 @@ namespace matplotlibcpp {
315315
bool operator()(const IterableX& x, const IterableY& y, const std::string& format)
316316
{
317317
// It's annoying that we have to repeat the code of plot() above
318-
auto xs = std::distance(std::begin(x), std::end(x));
319-
auto ys = std::distance(std::begin(y), std::end(y));
318+
using std::distance;
319+
using std::begin;
320+
using std::end;
321+
322+
auto xs = distance(begin(x), end(x));
323+
auto ys = distance(begin(y), end(y));
320324
assert(xs == ys && "x and y data must have the same number of elements!");
321325

322326
PyObject* xlist = PyList_New(xs);
323327
PyObject* ylist = PyList_New(ys);
324328
PyObject* pystring = PyString_FromString(format.c_str());
325329

326-
auto itx = std::begin(x), ity = std::begin(y);
330+
auto itx = begin(x), ity = begin(y);
327331
for(size_t i = 0; i < xs; ++i) {
328332
PyList_SetItem(xlist, i, PyFloat_FromDouble(*itx++));
329333
PyList_SetItem(ylist, i, PyFloat_FromDouble(*ity++));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy