"Ed Brey" <[EMAIL PROTECTED]> writes: > Extract is confusing. One problem is that it is deceivingly named.
The name was my suggestion, so I'm going to argue with you a bit about that. > It doesn't extract data from the variant at all, but rather provides > type-specific access to data that still resides in the variant. "Provides type-specific access to data that still resides in the variant" is a mouthful, but I'm still not sure what it means. How is it different from extracting the data? > It is not clear from the name or the documentation that this would > be bad: > > variant<int>* v = new variant<int>; extract<int> i(*v); delete v; > return i; Ugh. Is it clear from the name that this would be bad? std::back_insert_iterator<std::vector<int> > f() { vector<int> v; return back_inserter(v); } If the documentation for extract doesn't say that behavior is undefined if extraction occurs after the constructor argument is destroyed, it should. Wouldn't that cover your (rather implausible) case? > The area would be helped by renaming extract to access. How is "access" any clearer? "Access" can plausibly be interpreted as a noun or a verb in the context of variant, so I don't like it very much. BTW, I just realized that a conversion from variant<T> to optional<T> could be used to do extraction as well. Maybe it would be better to ditch extract altogether and just use optional? -- Dave Abrahams Boost Consulting www.boost-consulting.com _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost