Can you guarantee destructor order when objects are declared on a stack?

后端 未结 5 688
-上瘾入骨i
-上瘾入骨i 2021-02-12 14:34

I have code that controls a mutex lock/unlock based on scope:

void PerformLogin()
{
    ScopeLock < Lock > LoginLock( &m_LoginLock );

    doLoginComma         


        
5条回答
  •  青春惊慌失措
    2021-02-12 14:45

    Yes, destructors are the reverse of constructors. Because destructors are used to delete the objects which are no longer required and constructor are use to create the objects.

提交回复
热议问题