<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[decltype &amp;amp; &#x27;...&#x27; is private]]></title><description><![CDATA[<pre><code>class A {
private:
    long_type member;
};

class B {
private:
    decltype(A::member)::type member;
};
</code></pre>
<p>ergibt:</p>
<blockquote>
<p>error: 'long_type A::member' is private</p>
</blockquote>
<p>Sollte das nicht egal sein? Ich finde das unsinnig das zu verbieten (?).</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/318711/decltype-amp-is-private</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Jul 2026 06:56:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/318711.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 23 Jul 2013 17:05:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 17:06:09 GMT]]></title><description><![CDATA[<pre><code>class A {
private:
    long_type member;
};

class B {
private:
    decltype(A::member)::type member;
};
</code></pre>
<p>ergibt:</p>
<blockquote>
<p>error: 'long_type A::member' is private</p>
</blockquote>
<p>Sollte das nicht egal sein? Ich finde das unsinnig das zu verbieten (?).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340685</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340685</guid><dc:creator><![CDATA[5cript]]></dc:creator><pubDate>Tue, 23 Jul 2013 17:06:09 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 17:11:15 GMT]]></title><description><![CDATA[<p>Tim06TR schrieb:</p>
<blockquote>
<p>Sollte das nicht egal sein? Ich finde das unsinnig das zu verbieten (?).</p>
</blockquote>
<p>Dann tu es doch nicht. Du warst es, der A::member privat gemacht hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340689</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340689</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 23 Jul 2013 17:11:15 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 17:33:04 GMT]]></title><description><![CDATA[<p>Ich will dass die Variable von außen hin nicht sichtbar ist, aber den Variablentyp für decltype unnutzbar zu machen ist doch sinnlos.</p>
<p>und eine Template daraus zu machen ist übertrieben.<br />
Ich tippe auf einen Designfehler, trotzdem bleibt meine Kritik: Zugriffspezifizierer sollten darauf keinen Einfluss haben.<br />
In wie fern gibt mir das nun mehr Kapselung?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340694</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340694</guid><dc:creator><![CDATA[5cript]]></dc:creator><pubDate>Tue, 23 Jul 2013 17:33:04 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 17:37:54 GMT]]></title><description><![CDATA[<p>Tim06TR schrieb:</p>
<blockquote>
<p>Ich will dass die Variable von außen hin nicht sichtbar ist, aber den Variablentyp für decltype unnutzbar zu machen ist doch sinnlos.</p>
</blockquote>
<p>Dir ist klar, dass Memberobjekte nach außen hin einfach gar nicht existieren sollen, oder? Dass es dann irgendwie doch da ist macht überhaupt keinen Sinn.</p>
<blockquote>
<p>Ich tippe auf einen Designfehler</p>
</blockquote>
<p>Das ist <strong>kein</strong> Designfehler.</p>
<blockquote>
<p>, trotzdem bleibt meine Kritik: Zugriffspezifizierer sollten darauf keinen Einfluss haben.</p>
</blockquote>
<p>Und jeder hier im Forum sagt dir: Blödsinn.</p>
<blockquote>
<p>In wie fern gibt mir das nun mehr Kapselung?</p>
</blockquote>
<p>Indem der User deine Implementierung nicht kennt.</p>
<p>Mach doch um himmelswillen einfach ein typedef.</p>
<pre><code>class A {
private:
    long_type member;
public:

    using value_type = long_type;
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2340697</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340697</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Tue, 23 Jul 2013 17:37:54 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 17:38:28 GMT]]></title><description><![CDATA[<p>Tim06TR schrieb:</p>
<blockquote>
<p>Ich will dass die Variable von außen hin nicht sichtbar ist, aber den Variablentyp für decltype unnutzbar zu machen ist doch sinnlos.</p>
</blockquote>
<p>Das ist ein Widerspruch. Die Variable kann nicht gleichzeitig sichtbar und nicht sichtbar sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340698</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340698</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Tue, 23 Jul 2013 17:38:28 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 18:23:05 GMT]]></title><description><![CDATA[<p>Tim06TR schrieb:</p>
<blockquote>
<p>Ich tippe auf einen Designfehler, trotzdem bleibt meine Kritik: Zugriffspezifizierer sollten darauf keinen Einfluss haben.</p>
</blockquote>
<p>Die &quot;Zugriffspezifizierer&quot; beschränken in C++ ja nicht den Zugriff, sondern ob du das Ding von Ausserhalb &quot;benennen&quot; darfst.<br />
Und dann ist es nur konsequent dass hier für <code>decltype</code> keine Ausnahme gemacht wird. Denn um <code>decltype</code> zu machen müsstest du das Ding ja auch erstmal benennen.</p>
<p>Und natürlich bricht es die Kapselung. Und zwar so:</p>
<pre><code class="language-cpp">class foo
{
private:
    class very_very_private_helper { ... };

    very_very_private_helper m_helper;
}

void very_bad_function(foo&amp; f)
{
    decltype(foo::m_helper) h;  // &lt;------ das sollten wir nicht können
    h.do_very_private_stuff(f); //         und das schon gar nicht
}
</code></pre>
<p>Wenn du jetzt meinst dass das sowieso nicht ginge, weil <code>very_very_private_helper</code> ja private ist, und daher sowieso nicht ausserhalb von foo verwendet werden kann, dann hier nochmal der Hinweis: es ist nur verboten private Dinge von ausserhalb zu benennen, nicht sie zu verwenden!</p>
<p>Siehe hier:<br />
<a href="http://ideone.com/TK0wQL" rel="nofollow">http://ideone.com/TK0wQL</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340708</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340708</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Tue, 23 Jul 2013 18:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to decltype &amp;amp; &#x27;...&#x27; is private on Tue, 23 Jul 2013 18:26:58 GMT]]></title><description><![CDATA[<p>EDIT: Danke für das Beispiel. Das leuchtet ein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2340709</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2340709</guid><dc:creator><![CDATA[5cript]]></dc:creator><pubDate>Tue, 23 Jul 2013 18:26:58 GMT</pubDate></item></channel></rss>