View Full Version : QList<MyClass> to const QList<const MyClass>
juanluispaz
2nd May 2010, 21:06
Hello, How can I cast a QList to a constant QList of constant values without create a new QList (create a constant view of the list)
Example:
// This not compile
QList<MyClass> a;
// ...
const QList<const MyClass> b = a;
I want to use this for return the list as constant (with constant values too).
axeljaeger
6th May 2010, 10:08
const QList<const MyClass> b(a); could work.
juanluispaz
6th May 2010, 17:11
I tested this solution, but does not compile.
Thank you for reply.
axeljaeger
6th May 2010, 17:13
What is the error message?
juanluispaz
6th May 2010, 19:27
The error message is:
error: no matching function for call to 'QList<const MyClass>::QList(QList<MyClass>&)'
note: candidates are: QList<T>::QList(const QList<T>&) [with T = const MyClass]
note: QList<T>::QList() [with T = const MyClass]
In this moment, I am using Qt 4.6 (2010.02.1) with wingw
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.