8000 examples: update span.cpp after introducing support for contiguous ra… · LipsonX/matplotlib-cpp@a08b67a · GitHub
[go: up one dir, main page]

Skip to content

Commit a08b67a

Browse files
committed
examples: update span.cpp after introducing support for contiguous ranges
1 parent b0f57e5 commit a08b67a

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

examples/span.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ int main()
1818
3, 3, 3, 3
1919
};
2020

21-
size_t n=sizeof(t)/sizeof(decltype(t[0]));
22-
size_t m=sizeof(data)/sizeof(decltype(data[0]));
23-
24-
// Use std::span to pass data chunk to plot(), without copying it.
25-
// Unfortunately, plt::plot() makes an internal copy of both x and y
26-
// before passing them to python.
27-
for (size_t offset=0; offset<m; offset+=n)
28-
plt::plot(t, std::span {data+offset, n}, "");
21+
plt::plot(span(t, 4), span(data, 12));
2922
plt::show();
3023

3124
plt::detail::_interpreter::kill();

0 commit comments

Comments
 (0)
0