Boost logo

Boost Users :

Subject: Re: [Boost-users] [phoenix] [clang] error assigning function object
From: Lee Clagett (forum_at_[hidden])
Date: 2016-01-09 13:56:10

On Sat, 9 Jan 2016 13:39:33 -0500
Lee Clagett <forum_at_[hidden]> wrote:
> namespace phx = boost::phoenix;
> int foo;
> auto lazy_assign = (phx::ref(foo) = phx::placeholders::_1);
> `lazy_assign` is a phoenix actor, whose `operator()` will take the
> first argument by const reference and assign it to `foo`. But it is
> also a phoenix actor like `phoenix::ref`, so:
> lazy_assign = (phx::placeholders::_2);
> tries to create new phoenix actor (lazy function), whose semantics are
> really confusing (and thus an error is likely appropriate).

I just realized this is valid code since `operator=` returns a
reference to the left-hand-size. Although, its still an odd expression.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at