View previous topic :: View next topic |
Author |
Message |
anggelus
Joined: 23 Feb 2005 Posts: 383 Location: Rīga (LV)
|
Posted: Tue Apr 05, 2005 5:33 pm Post subject: Templates |
|
Man ir viena problēma.
šis template nekompilējas ar Visual Studio 2003, ar Visual Studio 6 viss darbojas.
Code: |
template <class T> class IndexLock
{
public:
IndexLock( T* obj, T::LockType lock ) :
m_obj(obj) {
obj->lockIndices( lock );
}
~IndexLock() {
m_obj->unlockIndices();
}
private:
T* m_obj;
IndexLock();
IndexLock( const IndexLock& );
IndexLock& operator=( const IndexLock& );
};
|
Itkā LockType neesot definēts.
Kāds nezin, kas par vainu? _________________ No comprendo lo que dice. |
|
Back to top |
|
|
bubu Indago Uzvarētājs
Joined: 23 Mar 2004 Posts: 3223 Location: Riga
|
Posted: Tue Apr 05, 2005 6:15 pm Post subject: |
|
Nu manuprāt tā jau nevar. Tai templeitei T var jau arī būt nedefinēts tāds LockType. Un tad jau izteiksmei T::LockType, manuprāt, nav jēgas. Tāpēc arī errors metās. |
|
Back to top |
|
|
chaosman
Joined: 28 Oct 2003 Posts: 64 Location: Rīga
|
Posted: Tue Apr 05, 2005 6:16 pm Post subject: Re: Templates |
|
IndexLock( T* obj, typename T::LockType lock )
Pameegini shitaa. |
|
Back to top |
|
|
anggelus
Joined: 23 Feb 2005 Posts: 383 Location: Rīga (LV)
|
Posted: Tue Apr 05, 2005 6:32 pm Post subject: |
|
chaosman Thx. Viss darbojas _________________ No comprendo lo que dice. |
|
Back to top |
|
|
|