Why does Qt use arrow syntax? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
Is there a reason why Qt decided to replace the . with ->? Is there a technical reason why we do:
ui->statusBar->setSizeGripEnabled(false);
instead of
ui.statusBar.setSizeGripEnabled(false);
?

This isn't a choice of Qt, but the way proper design in C++ works. -> dereferences a pointer to an object to access a member of it. Passing a pointer around tends to be the cleanest method of access to an object.

Related

What are rich pointers in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I like C++ and follow its development.
While browsing I came across this link:
http://www.cplusplus-soup.com/2012/01/rich-pointers-frequently-asked.html
Can someone explain the concept of rich pointers in simple terms ?
At least as I read it, they're "tagged pointers". In other words, the pointer doesn't just carry the address of the item it points at, but has some associated metadata to tell what sort of thing the pointer is intended to point at.

Is performance affected if multiple threads use the same object? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
The object in this case is a dictionary with some search methods. Only reading operations.
Quick answer: No.
Quite the opposite, it will speed up your program, especially if you have an object that needs to load a lot of data into memory.
Just make sure nothing can write to the object while the threads run.

c++ conversion const member [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have a member L that is a list of pairs of ints which I would like to use in a const function. I'm hence not supposed to modify L, but I don't know how I can iterate through L, to read its contents (as opposed to modifying them).
The compiler keeps saying there is a conversion issue.
Assuming you are using std::list<std::pair<int,int>> you need to use std::list<std::pair<int,int>>::const_iterator as the type for your iterator.

Should unique_ptr be used for class member pointers? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
Looking for some opinions on this as it's unclear in reading the C++ 11 documentation.
Absolutely. This takes care of the rule of three for you.

Multiple inheritance in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
As you know, C++ allows multiple inheritance. But, would it be a good programming approach to use multiple inheritance or it should be avoided?
Thanks.
In general, it's not needed and can make your code more complex.
But there are cases where it's useful. As long as it's useful and isn't causing your code to become unmanageable, I see no reason to avoid it.