Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just one minor quibble: I'd say it's C++'s classes (not move semantics) that made doing things like this much cleaner - mostly by having a destructor that let's data structures automatically clean up after themselves (release memory) when they go out of scope. Now the developer doesn't need to know or care about whether the structure they were given has internal dynamically allocated components or not.

Move semantics is "just" an optimization that makes passing data-owning classes around more efficient. Pre C++11 you'd just return the class by reference to avoid the inefficiency of return by value, but with move semantics you can treat complex types the same as simple ones, and not worry about the efficiency of how you pass them around.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: