C++ synax

I am no expert in C++ and need some help figuring out the expression attached.

Am I correct to state that QBluetoothLocalDevice::allDevices(); "method" of object QBluetoothLocalDevice
returns pointer infos of type QList<QBluetoothHostInfo> ?

Where can read something about this type of pointer and what are parts of it called ?

Perhaps plain English verbatim description of the line of code would help me to find right chapter in the C++ book.

Please keep in mind that English is not my native language.
Basically I do not know anything about < > usage in this case.

    QList<QBluetoothHostInfo> infos = QBluetoothLocalDevice::allDevices();
Last edited on
QBluetoothLocalDevice::allDevices() is a call to the static member function allDevices of the type QBluetoothLocalDevice.

All member functions are associated with class types, but static member functions in particular do not require an object to be called. That is, there is no need to create an object of type QBluetoothLocalDevice in order to call its allDevices member function.

The angle brackets < and > serve here only as grouping characters: nothing is being compared.
QList<QBluetoothHostInfo> is the type of a list of QBluetoothHostInfo objects; similarly QList<int> is the type of a list of integers. QList itself is an example of a class template, while QList<QBluetoothHostInfo> is a class.

Read the documentation:
Last edited on
OK, so the angle brackets are to identify the object type similar to C space likes int a .
That is all I was asking for. ( The doc would not cover such basic .)
...while QList<QBluetoothHostInfo> is a class." I'll need to think more about this.
But for another clarification - when one uses the "class" and when "object" ?
If "class" is variable type, when is "object" used as description of what ?
Sorry to ask, but these basic concepts are seldom subject of a discussion for gurus.
C++ allows 'template' classes which are built during compile time based off the types provided. The most common use is containers, and you see that here, qlist is likely a linked list type thing and it contains a list of blutoothhostinfo things. It could have been a list of integers:
QList<int> intlist;

so you have a container of objects here.
I recommend you stop for a moment and examine the c++ containers like vector, get a bit of a handle on that before trying to understand 3rd party tools. These are language intermediate (but still core!) concepts without which you will struggle a lot.
Topic archived. No new replies allowed.