Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2003-02-19 18:49:53

Joel de Guzman wrote:
> I'll also be needing variant a lot from inside template code. I
> dislike the template keyword that gets in the way. IMO, the way to go
> is the
> C++ cast style syntax: extract<T>(v). There should only be one way
> to do this. Not two. And FWIW, there's a precedent. Although
> currently, boost::tuples has two ways to access its elements
> get<N>(t) and t.get<N>(),
> the TR (and the one that will be a part of the standard) for tuples
> does not have the member get anymore. IMO, this is a strong case
> *for* the free
> cast style and *against* the member function style. The variant and
> optional should strive to follow tuple's lead. In fact, come to think
> of it, why not just:
> get<T>(v)
Compelling argument, and I like the suggestion. For consistency with tuples, get would always return a reference or throw. The remaining question would then be what the nothrow version would look like. Perhaps get_ptr<T>(v).

Boost list run by bdawes at, gregod at, cpdaniel at, john at