Boost Users :
Subject: Re: [Boost-users] [PROTO] Custom functions, scalar terminal and make_expr vs details::as_expr_if
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2008-11-30 05:15:59
Eric Niebler a écrit :
> The first question to ask is if it is really absolutely necessary to
> prevent users from creating invalid expressions with
> my_custom_binary_func(), or if you can catch the error someplace else;
> e.g., when users try to evaluate the expression. Reporting a hard
> error later can often yield a better error message then using SFINAE
> to prune overload sets earlier.
OK then, but I don't really want my user face a large template error
because they mismatched some binary function arguments when they can
have a nice 'no such function F(A,B)' error message instead.
The solution of enumerating the (expr,expr) (expr,scalar) (scalar,expr)
variants is maybe what's needed then ?
The only problem I see is that enumerating the ternary one will be real
> If you want to improve compile times even more, you can avoid
> make_expr entirely and code by-hand what make_expr would do. So, e.g.,
> the second overload above would be:
Why is this faster than calling make_expr ? Even worse, doesn't it
defeat the proto purpose ?
Or am I in a situation I have to write dirty code like this and only use
Proto as a expression builder ?
-- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35
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