<?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[Const-Ärger mit Pool]]></title><description><![CDATA[<p>Ich habe hier einen Code, der unter Linux einwandfrei compiliert, aber mit Visual Studio 2010 nicht:</p>
<pre><code class="language-cpp">boost::object_pool&lt;Triangle&gt; trianglePool;
...bla...
Triangle* Mesh::createNewTriangle(Point_3* p0,Point_3* p1,Point_3* p2,Triangle* parent)
{
	Triangle* ret=this-&gt;trianglePool.construct(p0,p1,p2);
...bla...
}
</code></pre>
<pre><code>2&gt;C:/windev/otherLib/boost_1_46_1\boost/pool/detail/pool_construct_simple.inc(39): error C2664: 'Triangle::Triangle(Point_3 *&amp;,Point_3 *&amp;,Point_3 *&amp;)': Konvertierung des Parameters 1 von 'CGAL::Point_3&lt;R_&gt; ' in 'Point_3 *&amp;' nicht möglich
2&gt;          with
2&gt;          [
2&gt;              R_=CGAL::Epeck
2&gt;          ]
2&gt;          Durch die Konvertierung gehen Qualifizierer verloren
2&gt;          C:\windev\mergeLib\Mesh.cpp(369): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template &quot;Triangle *boost::object_pool&lt;T&gt;::construct&lt;Point_3*,Point_3*,Point_3*&gt;(const T0 &amp;,const T1 &amp;,const T2 &amp;)&quot;.
2&gt;          with
2&gt;          [
2&gt;              T=Triangle,
2&gt;              T0=Point_3 *,
2&gt;              T1=Point_3 *,
2&gt;              T2=Point_3 *
2&gt;          ]
</code></pre>
<pre><code class="language-cpp">template &lt;typename T0, typename T1, typename T2&gt;
element_type * construct(const T0 &amp; a0, const T1 &amp; a1, const T2 &amp; a2)
{
  element_type * const ret = (malloc)();
  if (ret == 0)
    return ret;
  try { new (ret) element_type(a0, a1, a2); }
  catch (...) { (free)(ret); throw; }
  return ret;
}
</code></pre>
<p>Ich habe mich noch nicht an die Meldungen von Visual Studio gewöhnt, aber für<br />
mein Verständnis bemängelt VS die Zeile try {new (ret) element_type(a0, a1,<br />
a2);}&quot;, weil die die konstanten Pointer an einen Konstruktor gibt, der die<br />
Pointer nicht konstant behandelt. Das sollte dann aber auch unter Linux<br />
nicht gehen, und so ein Fehler in Boost ist doch sehr unwahrscheinlich. Kann<br />
mir bitte jemand erklären, was es da genau hat?</p>
<p>Danke, lg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/289765/const-ärger-mit-pool</link><generator>RSS for Node</generator><lastBuildDate>Tue, 18 Aug 2026 23:51:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/289765.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Jul 2011 13:39:37 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Const-Ärger mit Pool on Tue, 12 Jul 2011 13:39:37 GMT]]></title><description><![CDATA[<p>Ich habe hier einen Code, der unter Linux einwandfrei compiliert, aber mit Visual Studio 2010 nicht:</p>
<pre><code class="language-cpp">boost::object_pool&lt;Triangle&gt; trianglePool;
...bla...
Triangle* Mesh::createNewTriangle(Point_3* p0,Point_3* p1,Point_3* p2,Triangle* parent)
{
	Triangle* ret=this-&gt;trianglePool.construct(p0,p1,p2);
...bla...
}
</code></pre>
<pre><code>2&gt;C:/windev/otherLib/boost_1_46_1\boost/pool/detail/pool_construct_simple.inc(39): error C2664: 'Triangle::Triangle(Point_3 *&amp;,Point_3 *&amp;,Point_3 *&amp;)': Konvertierung des Parameters 1 von 'CGAL::Point_3&lt;R_&gt; ' in 'Point_3 *&amp;' nicht möglich
2&gt;          with
2&gt;          [
2&gt;              R_=CGAL::Epeck
2&gt;          ]
2&gt;          Durch die Konvertierung gehen Qualifizierer verloren
2&gt;          C:\windev\mergeLib\Mesh.cpp(369): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template &quot;Triangle *boost::object_pool&lt;T&gt;::construct&lt;Point_3*,Point_3*,Point_3*&gt;(const T0 &amp;,const T1 &amp;,const T2 &amp;)&quot;.
2&gt;          with
2&gt;          [
2&gt;              T=Triangle,
2&gt;              T0=Point_3 *,
2&gt;              T1=Point_3 *,
2&gt;              T2=Point_3 *
2&gt;          ]
</code></pre>
<pre><code class="language-cpp">template &lt;typename T0, typename T1, typename T2&gt;
element_type * construct(const T0 &amp; a0, const T1 &amp; a1, const T2 &amp; a2)
{
  element_type * const ret = (malloc)();
  if (ret == 0)
    return ret;
  try { new (ret) element_type(a0, a1, a2); }
  catch (...) { (free)(ret); throw; }
  return ret;
}
</code></pre>
<p>Ich habe mich noch nicht an die Meldungen von Visual Studio gewöhnt, aber für<br />
mein Verständnis bemängelt VS die Zeile try {new (ret) element_type(a0, a1,<br />
a2);}&quot;, weil die die konstanten Pointer an einen Konstruktor gibt, der die<br />
Pointer nicht konstant behandelt. Das sollte dann aber auch unter Linux<br />
nicht gehen, und so ein Fehler in Boost ist doch sehr unwahrscheinlich. Kann<br />
mir bitte jemand erklären, was es da genau hat?</p>
<p>Danke, lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091852</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091852</guid><dc:creator><![CDATA[bts3]]></dc:creator><pubDate>Tue, 12 Jul 2011 13:39:37 GMT</pubDate></item><item><title><![CDATA[Reply to Const-Ärger mit Pool on Tue, 12 Jul 2011 13:57:52 GMT]]></title><description><![CDATA[<p>Sieht so aus, als würde der Konstruktor von Triangle aus welchen Gründen auch immer die Pointer als nicht-konstante Referenz statt als Kopie nehmen. <code>construct</code> werden die aber als <code>const</code> übergeben, können also nicht an eine Referenz gebunden werden.</p>
<p>Unter Linux geht es möglicherweise, weil da in <code>construct</code> schon Perfect Forwarding benutzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091862</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091862</guid><dc:creator><![CDATA[ipsec]]></dc:creator><pubDate>Tue, 12 Jul 2011 13:57:52 GMT</pubDate></item><item><title><![CDATA[Reply to Const-Ärger mit Pool on Tue, 12 Jul 2011 14:15:40 GMT]]></title><description><![CDATA[<p>ipsec schrieb:</p>
<blockquote>
<p>Sieht so aus, als würde der Konstruktor von Triangle aus welchen Gründen auch immer die Pointer als nicht-konstante Referenz statt als Kopie nehmen. <code>construct</code> werden die aber als <code>const</code> übergeben, können also nicht an eine Referenz gebunden werden.</p>
<p>Unter Linux geht es möglicherweise, weil da in <code>construct</code> schon Perfect Forwarding benutzt.</p>
</blockquote>
<p>Stimmt, wenn man den Konstruktor des Triangle's ändert, geht es. Mich hat bloß<br />
interessiert, warum Linux das durchgehen läßt.</p>
<p>lg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091873</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091873</guid><dc:creator><![CDATA[bts3]]></dc:creator><pubDate>Tue, 12 Jul 2011 14:15:40 GMT</pubDate></item><item><title><![CDATA[Reply to Const-Ärger mit Pool on Tue, 12 Jul 2011 14:57:27 GMT]]></title><description><![CDATA[<p>Linux hat damit aber weniger zu tun - du meinst wohl den gcc (der aber auch unter Windows läuft <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";-)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2091895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2091895</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Tue, 12 Jul 2011 14:57:27 GMT</pubDate></item></channel></rss>