Boost logo

Boost :

From: Gennadiy Rozental (gennadiy.rozental_at_[hidden])
Date: 2003-04-05 00:20:12


> I argue that top-level const type arguments are meaningless in the context
> of variant. Given the example you provide:
>
> typedef boost::variant<int const, std::string const> GlobalParameter;
>
> GlobalParameter input_socket(12345);
> input_socket = 54321; // no way to prevent this!!

How come!? It should be very easy to prohibit all mutating operations for
variant once it has top level const bound types (with static asserts)

> We can put it in the docs, but it seems straightforward that a const
variant
> would, in fact, not allow modification. What reason would lead someone to
> believe otherwise?

No. I meant that: Would we decide to keep the current semantic (without top
level const) we need to say explecetly what to do to define variant type for
constant object.

Gennadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk