Followers 0

# sizeof() giving strange results...

## 28 posts in this topic

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.
0

##### Share on other sites

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 =)

0

##### 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
2

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

2

## Create an account

Register a new account