variants

Started by
6 comments, last by hello2k1 21 years, 7 months ago
Does anyone know what exactly they are, and how to use them? A friend of mine recommended using them, and gave me a website (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap7_5alv.asp?frame=true), but I just can''t find any info I can use. Thanks.
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
Advertisement
A varient lets you use a single variable to store many types of data (a pointer to an object, an integer, a float, a string) and convert between them. They are useful in areas like database programming, however they are *slow* (basically every read/write requires a background code to be perform to determine what format the data is currently stored in and what format it must be converted to).
Hmm, sounds like what I need. Does anyone know how to use them?
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
It''s the default VB data-type.

You can use the ATL helper class _variant_t or Boost''s Any type.
Both are pretty easy to use. Any is portable C++ code. _variant_t is ole-automation & COM compatible.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
You have any links, or tutorials?
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
Before I go trying to find a link, you are using c++ right?
Yes, C++. Thank you.
------------------------------There are 10 types of people in this world, those who know binary, and those who don't.
www.boost.org

look for 'any' in documentation

edit:
found the link for you. if you take the time you'll grow to love this site.

[edited by - petewood on August 29, 2002 11:44:39 AM]

This topic is closed to new replies.

Advertisement