$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [variant] assign and access the assigned value simultaneously
From: TONGARI J (tongari95_at_[hidden])
Date: 2014-03-19 03:26:34
2014-03-19 15:13 GMT+08:00 Antony Polukhin <antoshkka_at_[hidden]>:
> 2014-03-14 10:22 GMT+04:00 feverzsj <feverzsj_at_[hidden]>:
> <...>
>
> > why not supply a interface like:
> >
> > Val& v = var.assign(val);
> >
> > for simplity, and the unnecessary "get" is also elimited.
> >
>
> Such interface is not common for C++. Most programmers are used to the
> following:
>
> class_name& class_name::operator=(const class_name&);
> or
> class_name& class_name::operator=(const class_internal&);
>
> While you propose to implement `class_internal& class_name::operator=(const
> class_internal&);`
>
I don't think he's proposing that for operator=, but a not-yet-exist assign
method.
Seems reasonable to me, sometimes we do want to do some immediate
operations after the assignment.