C++ Copy Constructor Syntax

c++

Solution

It has nothing todo with copy ctor. You are initializing the variable m_nSize using initializer list with the sizeof the template argument t1.

Problem

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!

Original source