Boost logo

Boost Users :

Subject: Re: [Boost-users] [Proto] Reducing domain check in operator
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2009-02-26 11:23:51


Eric Niebler a écrit :
> Could you tell me a bit more about your usage scenario? This is
> certainly an area in which Proto can improve, and I want to understand
> your requirements.
I'm still working with this vec<T> grammar.

Basically I have template domain and template grammar and I want to have
element of two different grammar type instance to be usable by the other
for some operator/function.

For example, I have a SIMD float entity :

vec<float> x;

Normally, the grammar that dictates this entity behvaior is

tempalte<class SIMDTypeInfo>
struct grammar
: or_< terminal< simd_data<SIMDTypeInfo> >
        , arithmetic_values
       , nary_expr< _, narg< grammar<SIMDTypeInfo> >
> {};

(or something related)

This grmmar ensure that I can write things like :

vec<float>+vec<float>

but i can't do :

vec<float>+vec<char>

For most functions and operator it's sufficent.
But there is a few SIMD operator like for example exponent that can take
any vec<T> and return a vec<uint32_t>.

Currently the operators/functions use the underlying simd expression
info to determine their domain, thus leading to problem like :

exponent(vec<float>) + vec<uint32_t>

failing to compile cause the domain are not the same.

Now that I think of it, there is maybe a more elegant solution than
hacking the domain check but i'M a bit short of ideas atm.

-- 
___________________________________________
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