Topic: N3851, the array_view specification: notes
Author: Nicola Gigante <nicola.gigante@gmail.com>
Date: Wed, 5 Feb 2014 08:53:09 +0100
Raw View
Hello
> - This clearly shows that we need a way to specify that operator() takes =
_exactly_ Rank indices. There was recently such a proposal on this list. So=
mething like int...[Rank] was to be allowed. For the time being a static as=
sert on sizeof...(pars) =3D=3D rank will do.
>=20
Won't it be clearer for the user if you enable_if it instead of throwing a =
static_assert?
template<typename ...Indexes,
typename SFINAE =3D std::enable_if_t<sizeof...(Indexes) =3D=3D Rank>>
T &operator()(Indexes ...indexes) { /* ... */ }
Bye,
Nicola
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: "=?utf-8?B?YmlsbHkub25lYWxAZ21haWwuY29t?=" <billy.oneal@gmail.com>
Date: Wed, 05 Feb 2014 00:32:14 -0800
Raw View
------=_Part_0_1391589134988
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
Don't think so. Enable if will cause a "no such function" message, while st=
atic assert can have a more specific message.
Sent from a touchscreen. Please excuse the brevity and tpyos.
----- Reply message -----
From: "Nicola Gigante" <nicola.gigante@gmail.com>
To: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Cc: "std-proposals@isocpp.org" <std-proposals@isocpp.org>
Subject: [std-proposals] Re: N3851, the array_view specification: notes and=
use cases for scientific computing
Date: Tue, Feb 4, 2014 11:53 PM
Hello
> - This clearly shows that we need a way to specify that operator() takes =
_exactly_ Rank indices. There was recently such a proposal on this list. So=
mething like int...[Rank] was to be allowed. For the time being a static as=
sert on sizeof...(pars) =3D=3D rank will do.
>=20
Won't it be clearer for the user if you enable_if it instead of throwing a =
static_assert?
template<typename ...Indexes,
typename SFINAE =3D std::enable_if_t<sizeof...(Indexes) =3D=3D Rank>>
T &operator()(Indexes ...indexes) { /* ... */ }
Bye,
Nicola
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_0_1391589134988
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/htm=
l4/strict.dtd">
<html><head></head><body><div style=3D"font-size: 12pt; font-family: Calibr=
i,sans-serif;"><div>Don't think so. Enable if will cause a "no such functio=
n" message, while static assert can have a more specific message.</div><div=
><br></div><div>Sent from a touchscreen. Please excuse the brevity and tpyo=
s.</div><br><div id=3D"htc_header">----- Reply message -----<br>From: "=
;Nicola Gigante" <nicola.gigante@gmail.com><br>To: "std-pro=
posals@isocpp.org" <std-proposals@isocpp.org><br>Cc: "std-p=
roposals@isocpp.org" <std-proposals@isocpp.org><br>Subject: [std=
-proposals] Re: N3851, the array_view specification: notes and use cases fo=
r scientific computing<br>Date: Tue, Feb 4, 2014 11:53 PM</div></div><br><p=
re style=3D"word-wrap: break-word; white-space: pre-wrap;">Hello
> - This clearly shows that we need a way to specify that operator() tak=
es _exactly_ Rank indices. There was recently such a proposal on this list.=
Something like int...[Rank] was to be allowed. For the time being a static=
assert on sizeof...(pars) =3D=3D rank will do.
>=20
Won't it be clearer for the user if you enable_if it instead of throwing a =
static_assert?
template<typename ...Indexes,
typename SFINAE =3D std::enable_if_t<sizeof...(Indexes) =3D=3D Rank>&=
gt;
T &operator()(Indexes ...indexes) { /* ... */ }
Bye,
Nicola
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/.">http://groups.google.com/a/isocpp.org/group/std-proposals/=
..</a>
</pre></body></html>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_0_1391589134988--
.
Author: Nicola Gigante <nicola.gigante@gmail.com>
Date: Wed, 5 Feb 2014 22:07:02 +0100
Raw View
--001a11c1e67669cb7504f1af232d
Content-Type: text/plain; charset=UTF-8
2014-02-05 billy.oneal@gmail.com <billy.oneal@gmail.com>:
> Don't think so. Enable if will cause a "no such function" message, while
> static assert can have a more specific message.
>
> That's why in my opinion the sfinae approach is better here. "no such
function" is exactly what the user gets every time he passes a wrong number
of arguments to any function call. From a logical point of view there's one
function with N arguments, not one function with a variadic list of
arguments with some constraint. The fact that the implementation uses
vararg templates and need to constrain the length of a parameter pack seems
like an implementation detail.
Anyway, it seems like a matter of taste.. :)
Bye,
Nicola
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a11c1e67669cb7504f1af232d
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">2014=
-02-05 <a href=3D"mailto:billy.oneal@gmail.com">billy.oneal@gmail.com</a> <=
span dir=3D"ltr"><<a href=3D"mailto:billy.oneal@gmail.com" target=3D"_bl=
ank">billy.oneal@gmail.com</a>></span>:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><u></u>
<div><div style=3D"font-size:12pt;font-family:Calibri,sans-serif"><div>Don&=
#39;t think so. Enable if will cause a "no such function" message=
, while static assert can have a more specific message.</div><br></div></di=
v>
</blockquote><div>That's why in my opinion the sfinae approach is bette=
r here. "no such function" is exactly what the user gets every ti=
me he passes a wrong number of arguments to any function call. From a logic=
al point of view there's one function with N arguments, not one functio=
n with a variadic list of arguments with some constraint. The fact that the=
implementation uses vararg templates and need to constrain the length of a=
parameter pack seems like an implementation detail.<br>
<br></div><div>Anyway, it seems like a matter of taste.. :)<br><br></div><d=
iv>Bye,<br>Nicola<br></div></div><br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a11c1e67669cb7504f1af232d--
.