PDA

View Full Version : NSNumber equivalent in Qt



ggdev001
27th February 2013, 10:39
Hello,

I was wondering what is a similar or equivalent class to NSNumber in iOS, in Qt??
https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html
Thanks.

lanz
27th February 2013, 10:51
Just list all the classes you are using in one thread :D

I don't think there's direct alternative, but you can use QVariant too.

wysota
27th February 2013, 12:11
long long int :)

ChrisW67
28th February 2013, 01:57
Or float, or double, or bool.

Using a generic storage like QVariant just because it is "equivalent" to the scripting-style-thingy NSNumber is ignoring the characteristics of the actual problem you are trying to solve. If you need to store integers use an appropriately sized int. If you want floating point use float or double, If you want boolean values use bool.