• Advertisement
Sign in to follow this  

sizeof() giving strange results...

This topic is 1823 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Btw, since equality operator in a Vector3 class is highly likely to be used frequently, you should seriously consider inlining it back. Just make sure it's available all translation units. You can define it in the header, or to make the code more tidy and clean, define it in an "inl" file and include it in the Vector3 header.

While that advice is generally correct, I want to point out that recent compilers can use link-time optimization and inline the function anyway.

Share this post


Link to post
Share on other sites
Advertisement

okeys, just to let you guys know, i read everything and learned more then i asked for.

thanks for all the insight, it really helps once you go back to optimizing just having heard about this stuff and spending a thought on this or two.

but for now, i am just happy it works now as expected, and i know what went wrong. never hurts to keep conventions though =)

Share this post


Link to post
Share on other sites
No. The proper implementation of operator = for a class where all members already know how to copy themselves is:
// This code block intentionally left empty
That's right. Make some use of your delete key! Don't implement what the compiler can already correctly do for you. Edited by iMalc

Share this post


Link to post
Share on other sites
There's also the = default option if using a C++11 compiler that supports it.
MyClass & operator=(const MyClass &) = default;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement