Topic: Naming base-classes


Author: Peter Koch Larsen <peter.koch.larsen@gmail.com>
Date: Wed, 29 Jun 2016 06:28:38 -0700 (PDT)
Raw View
------=_Part_45_358253090.1467206918504
Content-Type: multipart/alternative;
 boundary="----=_Part_46_2103583560.1467206918504"

------=_Part_46_2103583560.1467206918504
Content-Type: text/plain; charset=UTF-8

I often need to access the base-class, and this class is often templated.
This causes minor annoyances and is a maintenance problem.

template <class T>
struct B {...};

template<class T>
struct D: B<T>
{
    using base = B<T>;
....

};

I often encounter this problem when B and D are traits-classes, providing
information about the actual type T (where B and D might
contain information about the GUI-representation of T or how to transfer T
using a specific protocol).

It would be nice if I could name the class e.g. like
template<class T>
struct D: base = B<T>
{
//    using base = B<T>;  Not needed anymore.
....

};

This solution looks nice to me syntax-wise, mimicking the using-directive,
and should be rather easy to implement.

Has there been any proposals in this direction?

Best regards
Peter

--
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/99925bbf-8c85-4274-8d30-2bc640ad3900%40isocpp.org.

------=_Part_46_2103583560.1467206918504
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I often need to access the base-class, and this class=
 is often templated. This causes minor annoyances and is a maintenance prob=
lem.</div><div><br></div><div>template &lt;class T&gt;</div><div>struct B {=
....};</div><div><br></div><div>template&lt;class T&gt;</div><div>struct D: =
B&lt;T&gt;</div><div>{</div><div>=C2=A0=C2=A0=C2=A0 using base =3D B&lt;T&g=
t;;</div><div>...</div><div><br></div><div>};</div><div><br></div><div>I of=
ten encounter this problem when B and D are traits-classes, providing infor=
mation about the actual type T (where B and D might</div><div>contain infor=
mation about the GUI-representation of T or how to transfer T using a speci=
fic protocol).</div><div><br></div><div>It would be nice if I could name th=
e class e.g. like</div><div><div>template&lt;class T&gt;</div><div>struct D=
: base =3D B&lt;T&gt;</div><div>{</div><div>//=C2=A0=C2=A0=C2=A0 using base=
 =3D B&lt;T&gt;;=C2=A0 Not needed anymore.</div><div>...</div><div><br></di=
v><div>};</div><div><br></div><div>This solution looks nice to me syntax-wi=
se, mimicking the using-directive, and should be rather easy to implement.<=
/div><div><br></div><div>Has there been any proposals in this direction?</d=
iv><div><br></div><div>Best regards</div><div>Peter<br></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; 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/99925bbf-8c85-4274-8d30-2bc640ad3900%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/99925bbf-8c85-4274-8d30-2bc640ad3900=
%40isocpp.org</a>.<br />

------=_Part_46_2103583560.1467206918504--

------=_Part_45_358253090.1467206918504--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Wed, 29 Jun 2016 16:58:35 +0300
Raw View
On 29 June 2016 at 16:28, Peter Koch Larsen <peter.koch.larsen@gmail.com> wrote:
> I often need to access the base-class, and this class is often templated.
> This causes minor annoyances and is a maintenance problem.
>
> template <class T>
> struct B {...};
>
> template<class T>
> struct D: B<T>
> {
>     using base = B<T>;
> ...
>
> };
>
> I often encounter this problem when B and D are traits-classes, providing
> information about the actual type T (where B and D might
> contain information about the GUI-representation of T or how to transfer T
> using a specific protocol).
>
> It would be nice if I could name the class e.g. like
> template<class T>
> struct D: base = B<T>
> {
> //    using base = B<T>;  Not needed anymore.
> ...
>
> };
>
> This solution looks nice to me syntax-wise, mimicking the using-directive,
> and should be rather easy to implement.
>
> Has there been any proposals in this direction?


See
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/zNvQQTKvoLQ/-5qMiIqvOP4J
and
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/5MFmBEicqXY/ihmAgTCf7NYJ
and
http://open-std.org/JTC1/SC22/WG21/docs/papers/2014/n4225.html
(the last of which is also https://cplusplus.github.io/EWG/ewg-closed.html#157)

--
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/CAFk2RUZVPLH_LCPG-nCqKh_Pmgcq1pO8YR_a4Pjv0joEY%3Df4tQ%40mail.gmail.com.

.