I don' use T for arguments of constructor. It defines the type of a private attribute of my class, that's used inside my constructor. qiX,Y,Z are indexes to access to a (T m_xGrid[][][]) structure inside my class.
template<class T>
MyLibrary<T>::MyLibrary(qint32 qiX, qint32 qiY, qint32 qiZ)
{
// Testing values to be greater or equal to zero.
if (qiX < 0)
{
qDebug() << "MyLibrary<T>::MyLibrary: qiX = " << " is less than zero."
<< " Setting X value to zero.";
m_qiX = 0;
}
else
{
m_qiX = qiX;
}
// etc etc etc...
// Example of use of T
T xValue;
xValue = m_xGrid[1][1][1];
}
template<class T>
MyLibrary<T>::MyLibrary(qint32 qiX, qint32 qiY, qint32 qiZ)
{
// Testing values to be greater or equal to zero.
if (qiX < 0)
{
qDebug() << "MyLibrary<T>::MyLibrary: qiX = " << " is less than zero."
<< " Setting X value to zero.";
m_qiX = 0;
}
else
{
m_qiX = qiX;
}
// etc etc etc...
// Example of use of T
T xValue;
xValue = m_xGrid[1][1][1];
}
To copy to clipboard, switch view to plain text mode
Bookmarks