Solved Tuple in Qt. How?
-
@bogong said in Tuple in Qt. How?:
It's funny that your wrong reply got upvotes 5 times ...
Perhaps the upvotes refer to C++ bits which we can verify. I upvoted because I agree with @JKSH on the C++ part of his answer. I don't know Erlang so I just ignored that part.
-
@bogong said in Tuple in Qt. How?:
@JKSH Erlang tuples don't allow you to add elements dynamically at runtime either. - Really??? How about list_to_tuple??? How about turning matrix of tuples that been developed by me and published
From the documentation of Erlang Tuple (emphasis added by me):
A tuple is a compound data type with a fixed number of terms.
As for list_to_tuple:
This method is to convert a list to a tuple
This doesn't allow you to add new items to a tuple, it allows you to create a tuple from a list.
-
Can
std::tie
be something like what you want (example: http://cpp.sh/4ifyc)?You can't, however, convert a generic vector to a tuple at runtime as tuple needs to know its size at compile time.
-
@VRonin The question was about QT but NOT std ... But it's partly similar functionality. Similar - because there are no any functionality to create random tuple in runtime. I've been seeking something that is allowing me to use tuple like base-type for messages between Qt application modules. I am trying to define data-type standard for message exchange in my Qt Applications and testing different data type and see what is better to use in my own case.
-
@SGaist Could you be pleased to get real experience in Erlang before copy-pasting docs that is not in context ... And AGAIN - the question was about QT but not Erlang, not std ...
-
Issue closed ... Only @sierdzio, @raven-worx and @kshegunov written something that is related to topic. Appreciate it. Thx.
-
Indeed, I should have also mentioned erlang::append_element which returns a new longer tuple based on the term you wanted to add to the original tuple.
-
@bogong Apologies, I used
std::tuple
in my example but I was referring more of a tuple as an abstract concept more than anything else.Given your use needs, why wouldn't
QVariantList
be suitable? -
@VRonin Because it's super SLOW!!! I've tested it already. In case of huge data exchanging "anti-idiot" guard that is implemented in QVarianList is slowing down this structure itself. The second point - it's dynamical structure itself. Any dynamical always much slower than any statical, that is why I've been seeking something that will allow me to create statical structure dynamically in runtime and use it in any part of application. If data not changed through whole life-circle why would I store it in dynamical manner?
BTW - for me, after huge experience of mixing Objective-C in Qt/QML. The data exchange model that is using in Qt - THE BOTTLENECK in any performance issue of Qt. Sometimes I need to convert 3-5 times one piece of data only for being able to use it in QML. But this is price for cross-platform and I understand it.
-
@SGaist Could you be pleased to get real experience in Erlang before copy-pasting docs that is not in context ...