Topic: iterators of contiguous containers should always be pointer
Author: euloanty@live.com
Date: Sat, 19 Aug 2017 00:51:12 -0700 (PDT)
Raw View
------=_Part_3719_1931534493.1503129072374
Content-Type: multipart/alternative;
boundary="----=_Part_3720_614986850.1503129072374"
------=_Part_3720_614986850.1503129072374
Content-Type: text/plain; charset="UTF-8"
I think iterators for contiguous containers
(std::vector<T>,std::array<T>,std::basic_string<T>) should all be T*.
template<typename T>
class vector
{
public:
using pointer = T*;
using iterator = pointer;
};
It could solve following issues:
1.passing through C APIs
2.contiguous Iterator/Container issue(if Container<T>::iterator is T*, it
is a contiguous container)
3.converting one container to another easily
4.easy to learn and understand
--
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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/9fbe1657-287e-4177-bfad-c2fd65cab63a%40isocpp.org.
------=_Part_3720_614986850.1503129072374
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>I think iterators for contiguous containers (std::vec=
tor<T>,std::array<T>,std::basic_string<T>) should all be =
T*.</div><div><br></div><div>template<typename T></div><div>class vec=
tor</div><div>{</div><div>public:</div><div>=C2=A0 =C2=A0 =C2=A0 using poin=
ter =3D T*;</div><div>=C2=A0 =C2=A0 =C2=A0 using iterator =3D pointer;</div=
><div>};</div><div><br></div><div><br></div><div>It could solve following i=
ssues:</div><div>1.passing through C APIs</div><div>2.contiguous Iterator/C=
ontainer issue(if Container<T>::iterator is T*, it is a contiguous co=
ntainer)</div><div>3.converting one container to another easily</div><div>4=
..easy to learn and understand</div></div>
<p></p>
-- <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 <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/9fbe1657-287e-4177-bfad-c2fd65cab63a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9fbe1657-287e-4177-bfad-c2fd65cab63a=
%40isocpp.org</a>.<br />
------=_Part_3720_614986850.1503129072374--
------=_Part_3719_1931534493.1503129072374--
.