Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-10 Thread Gary Willoughby via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 23:22:49 UTC, ponce wrote: - RefCounted Only for D structs. std::shared_ptr works for all. RefCounted works with classes as well. http://dlang.org/phobos/std_typecons.html#.RefCounted

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-10 Thread Gary Willoughby via Digitalmars-d-learn
On Thursday, 10 September 2015 at 12:34:54 UTC, Daniel Kozák wrote: On Thu, 10 Sep 2015 11:38:35 + "Gary Willoughby" wrote: On Wednesday, 9 September 2015 at 23:22:49 UTC, ponce wrote: > - RefCounted > > Only for D structs. std::shared_ptr works for all. RefCounted works

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-10 Thread Daniel Kozák via Digitalmars-d-learn
On Thu, 10 Sep 2015 11:38:35 + "Gary Willoughby" wrote: > On Wednesday, 9 September 2015 at 23:22:49 UTC, ponce wrote: > > - RefCounted > > > > Only for D structs. std::shared_ptr works for all. > > RefCounted works with classes as well. > >

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:17:44 UTC, cym13 wrote: This is subtly missing the main question: isn't C++-like memory management of D classes possible with Unique, RefCounted and Scoped? - Unique C++ has move semantics which make moves explicit. D's Unique is more like the

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:17:44 UTC, cym13 wrote: This is subtly missing the main question: isn't C++-like memory management of D classes possible with Unique, RefCounted and Scoped? I understand the limitations you mentioned, but it I don't think it is a good idea to tell C++

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread cym13 via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:34:03 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 9 September 2015 at 20:17:44 UTC, cym13 wrote: This is subtly missing the main question: isn't C++-like memory management of D classes possible with Unique, RefCounted and Scoped? I understand the

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 19:53:55 UTC, ponce wrote: Oops, posted by mistake. On Wednesday, 9 September 2015 at 19:48:00 UTC, cym13 wrote: Hi, I know C++ and D without being a C++ or D guru (I know way more about D though). When talking about memory management the problem of RAII is

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread cym13 via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:05:06 UTC, ponce wrote: C++ only has a D struct equivalent so all destructors are called deterministically. It's the addition of classes that create the problems in D. C++ can also throw by value, something that D can't really do. C++ objects can be: -

What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread cym13 via Digitalmars-d-learn
Hi, I know C++ and D without being a C++ or D guru (I know way more about D though). When talking about memory management the problem of RAII is often mentioned along with the fact that classes use the GC. I know well the difference between structs and classes and don't want to talk about

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread ponce via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 19:48:00 UTC, cym13 wrote: Hi, I know C++ and D without being a C++ or D guru (I know way more about D though). When talking about memory management the problem of RAII is often mentioned along with the fact that classes use the GC. I know well the

Re: What is the difference between D and C++ regarding Unique, RefCounted and Scoped?

2015-09-09 Thread via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 20:37:40 UTC, cym13 wrote: Hence my question: in what? (I assume you are talking about Unique RefCounted etc and not about classes). I think you should just refer them to the relevant man pages. Explanations are just going to be confusing as they are