Hi all,

I would like to do the same as QT when for some class it is obliged to give a variable name.
For example QReadLocker, QWriteLocker, QMutexLocker.

It is not possible to declare

Qt Code:
  1. QReadWriteLock *myReadWriteLock = new QReadWriteLock();
  2. QReadLocker( myReadWriteLock );
To copy to clipboard, switch view to plain text mode 

but you have to give a variable name

Qt Code:
  1. QReadWriteLock *myReadWriteLock = new QReadWriteLock();
  2. QReadLocker myReadLocker( myReadWriteLock );
To copy to clipboard, switch view to plain text mode 

How is it achieved? I can't figure what in the code is done to obtain this behaviour.

Thanks for your help, I am delighted to learn something new in c++!

-- pium