merogin
Re:Writing comments about pointer ownership
on Sunday August 23, 2015 @04:26AM (#10105014)
And it won't work when switching the parameter order of byval, so you're correct. That's quite nasty.
Re:Writing comments about pointer ownership
on Sunday August 23, 2015 @04:08AM (#10104999)
Do you mean something like this? http://ideone.com/8tPPHy
Re:Writing comments about pointer ownership
on Sunday August 23, 2015 @03:43AM (#10104954)
Some people might ask why I chose to make the parameter of BlackBox::store an rvalue reference rather than an lvalue reference and force the client code to use std::move. While it is true that an lvalue reference would also have worked, if I did that, it would be impossible to write code like crate.store(std::make_unique<Gadget>(beeper, flasher));. I also happen to think that forcing the client to use std::move at the call sites is good rather than bad, because it communicates the intended effect to the reader.
Passing unique_ptr by value is the correct option here, it will accept temporaries just fine.And in my opionion, if you want safety quarantees like that, use Rust. I was a fan of the new C++ standards a while ago, but after having used them for some time, I found C is a lot nicer language. There's just way too much mental overhead when trying to write "idiomatic C++" and the compiler errors you sometimes get are just a waste of developer time.
Re:Cross-Platform UI in GitHub Desktop
on Wednesday August 19, 2015 @05:20PM (#10088578)
I haven't used the application (can't on Linux), but if the graph doesn't require user interactivity, using Cairo or some other software renderer (e.g. http://www.antigrain.com/) to just render the graph into a bitmap, would do the job faster and with less resource usage. Adding user interactivity on top of that shouldn't be a lot of work either.