Enumerating Variants

There痴 a lot going on here, and we池e going to explain away part of it as magic. Instead of implementing the IEnumVARIANT interface and doing filthy hacks to make it work, we値l implement the IVariantWalker interface. This is cheating. We値l have to implement IEnumVARIANT behind the scenes, but the details are so ugly that we値l hide them inside a class named CEnumVariant. Our iterator classes will delegate to a private instance of CEnumVariant.

I won稚 say that the resulting collection and iterator classes will be simple. But they will be possible, and I値l provide a wizard to generate them quickly. To illustrate the concept, I値l redesign the CDrivesO class. Instead of precalculating all the drives and hiding them in an internal collection, I値l calculate each drive as it is needed.