Gennadiy Rozental wrote:
> > 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)

Maybe I should take another approach:

  typedef boost::variant<int const, std::string const> GlobalParameter;
  GlobalParameter input_socket(12345);
  input_socket = "test"; // no way to prevent this

  // ...or if that doesn't convince you...
  GlobalParameter new_input_socket("test");
  input_socket = new_input_socket; // no way to prevent this either

I don't see why there remains such difficulty. Perhaps if someone other than
Gennadiy could explain Gennadiy's argument to me we could make some
progress.

Thanks,
Eric



_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to