Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Strange behavior with semantic action and custom tag function
From: Eric Niebler (eric_at_[hidden])
Date: 2008-10-11 12:04:37


Joel Falcou wrote:
> I'm stuck on some problem that may en dup silly.

<snip very beautifully written transform>

> This works. If I remove the bp::when<bp::_, bm::size_t<0>()>, it fails
> to compile when I try to use a hand-overloaded operator<< for
> displaying expression values on standard output.

Could you post the code? The problem is probably pretty simple.

> So, is there anything I missed (like deactivating operator<< in the
> grammar somehow ?) ?
>
> Other question :
> When defining custom tag to build new function, why does the make_expr
> tempalte doesn't do check on its argument
> to see if it's match the grammar of the domain it's bound to use ? Seems
> I'm forced to add additional layer of SFINAE to prevent those
> function to get called on w/e types.

It's true, with make_expr you can create expressions that don't conform
to the grammar for your domain. But a call to make_expr is pretty
explicit -- it can't happen by accident. And make_expr is to be used by
DSEL designers such as yourself who may use it to build an expression
template piecemeal ... the intermediate pieces of which may not conform
to the grammar, while the whole might. Does that make sense?

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net