Tried C++ to D. Wrong result.
Adam D. Ruppe
destructionator at gmail.com
Mon Nov 27 17:01:29 UTC 2017
On Monday, 27 November 2017 at 14:08:27 UTC, Dmitry wrote:
> https://pastebin.com/GzZQ7WHt
The first thing that jumped out to me is this:
size_t[] pending = new size_t[N];
size_t[] pendingNext = new size_t[N];
That's giving it N elements of zero, then you append to it later
with pending ~= i;
In the C++ version they are declared
std::vector<size_t> pending;
std::vector<size_t> pendingNext;
which doesn't put empty elements at it.
I suspect you will get better results by just making the D decls
size_t[] pending;
size_t[] pendingNext;
and leave the rest of the code the same and see what happens.
More information about the Digitalmars-d-learn
mailing list