Bill Baxter wrote: > Does Tango's Variant have a fixed type?
No; it's like Phobos'. > It seems the std2 Variant doesn't really care what the type of the > thing you stuff in it is, as long as it fits in the memory space > allotted. How is that useful? What's the use case for needing > something that can be either 2.4f or "fred"? (Sorry I don't know > what a "CVar" system is...) Think about Quake, or anything based on Id's engines. CVars are basically global variables you can set from the in-game console. The original problem was this: "I want a hash indexed by string going to... um... er... anything!" And thus, Variant was born. Incidentally, I've since changed to a design involving callbacks, so there you go. I suppose that it's, in a way, like D's support for typesafe variadic functions; except it only takes one value. :P > What I actually needed was something > with a fixed, internal type that could expose its value in a flexible > way via templated get/set routines. But for me a float property is > never going to mutate into a string property. > > --bb OK, your turn: why would you want something that wraps a single type in itself and has to be accessed via templates? Couldn't you just... use the type you want with templates? -- Daniel
