dpilger26 / NumCpp

C++ implementation of the Python Numpy library
https://dpilger26.github.io/NumCpp
MIT License
3.51k stars 548 forks source link

nc::append should be able to operate empty NdArray<> too. #194

Closed TorokLev closed 1 year ago

TorokLev commented 1 year ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

In Python it looks like this:

collector = np.array([])
np.append(collector, 3)

it should look similar in C++

#include <NumCpp.hpp>
nc::NdArray<double> collector;
nc::append( collector, {3});

but it breaks since collector is empty.

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

TorokLev commented 1 year ago

This applies to stack, vstack and hstack too.

dpilger26 commented 1 year ago

Implemented as part of release version 2.11.0.