I apologize in advance, my C++ is rusty...
What does
: m_nSize(sizeof(t1))
mean in the following section?
class CTypeSize
{
public:
template<class T>
CTypeSize(const T &t1) :
m_nSize(sizeof(t1))
{
}
~CTypeSize(void){ };
int getSize(void) const{ return m_nSize; }
private:
const int m_nSize;
};
I understand copy constructors, but I remember the syntax as Class::Class(const Class& p). Am I thinking of something else, or is that an alternative syntax?
Thanks!
It has nothing todo with copy ctor. You are initializing the variable m_nSize using initializer list with the sizeof the template argument t1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With