C++ Logo


Advanced search

Re: Fwd: Proposal of Handles (draft 2)

From: Simon Kraemer <sikraemer_at_[hidden]>
Date: Mon, 20 May 2019 14:28:14 +0200
Hello Andrew,

after reading through your proposal I found some things that don't seem
quite right.

While I can understand the need of a garbage collector in some use cases,
the one featured in the proposal is one of the less convincing examples.
The code is generating a lot of objects that are not needed anywhere just
to throw them away some time later.
For me, this is an anti-pattern.

Using a Dungeon class as owner for the rooms of the Dungeon, rather than
just defining ownership by the room self-referencing each other, you can
implement your example with an recursive approach:
There is still a lot to optimize, but I don't see the need for gc.


1. Your main-function uses 'uniform_real_distribution' instead of
'uniform_int_distribution'. This won't compile for size_t.
2. You are initializing the Mersenne-Twister generators with 'std::mt19937
gen(std::random_device{});' which should be 'std::mt19937
gen(std::random_device{}());' (parenthesis)

Am Fr., 17. Mai 2019 um 11:26 Uhr schrieb Andrew Tomazos via Std-Proposals <

> Oops, this was supposed to go to std-proposals_at_[hidden] not
> std-proposals_at_[hidden]
> ---------- Forwarded message ---------
> From: Andrew Tomazos <andrewtomazos_at_[hidden]>
> Date: Wed, May 15, 2019 at 9:20 PM
> Subject: Proposal of Handles (draft 2)
> To: <std-proposals_at_[hidden]>
> Please find attached a working draft of:
> Proposal of Handles
> Feedback appreciated.
> Regards,
> Andrew.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> http://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2019-05-20 07:30:14