Boost logo

Boost Users :

From: Nat Goodspeed (nat_at_[hidden])
Date: 2008-05-07 22:18:11


Igor R. wrote:

> The reason I wanted to test if the variant contains its 1st
> type is the following: my variant is made of a list
> of shared-pointers to various types; there's a routine that
> initializes it with one of the types depending on some
> conditions, then it applies some visitor on the resulting
> variant and stores it then in a container - however, there's
> no "default" behavior, so if neither condition was met, the
> variant remains "uninitialized" - i.e. it contains 1st type
> "zero" ptr. I want neither apply the visitor on "empty"
> smartpointer nor store it in the container, so I have to
> know whether it was "really" created or not.

Um, wrap the variant in boost::optional?


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net