Boost logo

Boost :

From: E. Gladyshev (egladysh_at_[hidden])
Date: 2003-10-07 20:17:48

--- Eric Friedman <ebf_at_[hidden]> wrote:

> template <typename Variant>
> class my_class
> {
> Variant var_;
> };

This is how I would like to use 'variant'.

> In the context of my_class, Variant is an "unknown" variant type.
> Nonetheless, objects of Variant (e.g., var_) operate according to rules
> that remain the same regardless of the types bounded by the variant. In
> the context of my_class, objects of Variant behave as any other
> variant<...> might. In short, I don't see any unpredictability here.

See my previous post on why it is unpredictable.

Another requirement is that I'd like to make sure that
    template <typename Variant>
    class my_class
      Variant var_;


    template <typename Variant, typename A = std::allocator<Variant> >
    class my_class
      std::vector<Variant, A> var_;

never touches the heap.


Do you Yahoo!?
The New Yahoo! Shopping - with improved product search

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