Re:Rust for C++ programmers – part 4: unique pointers
by kirab on Tuesday April 29, 2014 @04:45AM
(#7665752)
What the heck is this?
[ Parent
| on HN ]
Re:Rust for C++ programmers – part 4: unique pointers
by akavel on Tuesday April 29, 2014 @04:58AM
(#7665789)
I assumed it reads more or less like:
Foo *****y;
Or, probably, more like: std::unique_ptr<std::unique_ptr<std::unique_ptr<std::unique_ptr<std::unique_ptr<Foo>>>>> y;
Re:Rust for C++ programmers – part 4: unique pointers
by claudius on Tuesday April 29, 2014 @08:01AM
(#7666338)
Hey, at least you can write ‘>>>>>’ instead of ‘> > > > >’ now. :)
Re:Rust for C++ programmers – part 4: unique pointers
by kirab on Tuesday April 29, 2014 @05:31AM
(#7665873)
Thanks, I hope this is never needed anywhere, ever.
Re:Rust for C++ programmers – part 4: unique pointers
by pohl on Tuesday April 29, 2014 @12:12PM
(#7667962)
I suspect it's a deliberately-perverse example, meant only to illustrate how deeply method calls will automatically dereference.
Re:Rust for C++ programmers – part 4: unique pointers
by kzrdude on Tuesday April 29, 2014 @04:24PM
(#7669735)
It also dereferences through ~~~&~@~~&~Foo.
Re:Rust for C++ programmers – part 4: unique pointers
by alkonaut on Tuesday April 29, 2014 @05:06AM
(#7665812)
y is a pointer to a pointer to a pointer to a pointer to a pointer to an instance of Foo.
What the author wanted to show was that there is automatic dereference:
z = y.foo()
Will just reference through all five pointers and call the method on the object directly.