This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::max: if versus ?:


On Sun, 23 Sep 2012, Gabriel Dos Reis wrote:

On Sun, Sep 23, 2012 at 12:06 PM, Marc Glisse <marc.glisse@inria.fr> wrote:
On Sun, 23 Sep 2012, Gabriel Dos Reis wrote:

On Sun, Sep 23, 2012 at 10:09 AM, Marc Glisse <marc.glisse@inria.fr>
wrote:

Then that may mean no std::max for vectors, at least until someone makes
the
inner type and size of vectors deducible (that would make the vector
version
of max more specialized than the generic one and allow overloads without
touching the generic function). Which isn't that bad, people are big
enough
to write (x<y)?y:x themselves...


I do not understand why you can't have a syntax such as  __vector<T,N>
those extensions.   If that syntax isn't there, you should consider adding
it.  It is a natural thing to have.


The syntax exists (though it is ugly): T __attribute__((vector_size(N))).

that is why I suggested __vector<T,N>.

So you were only suggesting it as a syntax and not as an internal representation. I guess I can look at a nicer syntax once the feature actually works.


What doesn't work currently is that T and N are not deducible, in a template
context. One possibility would be to make them deducible

Yes. That is a more scalable solution, IMO.


(sounds like duplicating a bit of template machinery).

Why?

For array<T,N>, deduction works. For attributes, reading PR35758, there is going to be a lot of work to make it work.


--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]