Boost Users :
Subject: [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-29 11:02:33
I have a large number of custom unary and bin ary function that I map
using unary_expr and binary_expr.
The problem is the following : my grammar has integral or floating point
So, when I want to create a binary function that takes any elements of
my domain, I'm boudn to do the following :
template<class L,class R>
my_custom_binary_func( L const& l, R const& r )
return make_expr( ... );
Alas, as I already discussed with Eric, nothign prevent me to use
my_custom_binary_func over types
that aren't in my grammar. To do so, I was told to use SFINAE to prune
unwanted element by matching the result type
of make_expr on my grammar. However, this proves cumbersome and slow
down compile time by *a large factor* when
I have a large number of such function (and I have like 50 or 60).
So i wandered into proto source code and looked at how proto solves this
problem for its binary operator.
This solution seems more elegant but as it live sin proto::detail, I
don't think I'm intended to use it.
So, how can I have a simple and fast creation of custom expression ? Am
I missing something blatant ?
-- ___________________________________________ 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