<?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[template wählt falsche Funktion]]></title><description><![CDATA[<p>Ich habe foldenden Code</p>
<pre><code class="language-cpp">vector&lt;double&gt; amplitudeTime;
maxpos = ArrayCenterPos(amplitudeTime, 250.0);
</code></pre>
<p>mit foldendem Code in Header Datei</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
int ArrayCenterPos(vector&lt;T&gt; const &amp; InArray, T threshold)
{
	return ArrayCenterPos(&amp;InArray[0], (int)InArray.size(), threshold);
}

template&lt;typename T&gt;
int ArrayCenterPos(T * InArray, int size, T threshold)
{
...
}

int ArrayCenterPos(complex&lt;double&gt;* InArray, int size, double threshold)
{
...
}
</code></pre>
<p>ich bekomme aber den Fehler:</p>
<blockquote>
<p>1&gt;h:\Dev\CPP\SVN\modelocksimulation\ModelockingSimulation2\include\matthias\Common\ExtFunctions.h(325) : error C2664: 'int ArrayCenterPos(std::complex&lt;double&gt; *,int,double)' : cannot convert parameter 1 from 'const double *__w64 ' to 'std::complex&lt;double&gt; *'<br />
1&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
1&gt; .\src\LaserData.cpp(130) : see reference to function template instantiation 'int ArrayCenterPos&lt;double&gt;(const std::vector&lt;_Ty&gt; &amp;,T)' being compiled<br />
1&gt; with<br />
1&gt; [<br />
1&gt; _Ty=double,<br />
1&gt; T=double<br />
1&gt; ]</p>
</blockquote>
<p>den ich nicht vetstehe.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/241466/template-wählt-falsche-funktion</link><generator>RSS for Node</generator><lastBuildDate>Mon, 21 Sep 2026 11:28:10 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/241466.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 May 2009 21:34:49 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to template wählt falsche Funktion on Wed, 20 May 2009 21:34:49 GMT]]></title><description><![CDATA[<p>Ich habe foldenden Code</p>
<pre><code class="language-cpp">vector&lt;double&gt; amplitudeTime;
maxpos = ArrayCenterPos(amplitudeTime, 250.0);
</code></pre>
<p>mit foldendem Code in Header Datei</p>
<pre><code class="language-cpp">template&lt;typename T&gt;
int ArrayCenterPos(vector&lt;T&gt; const &amp; InArray, T threshold)
{
	return ArrayCenterPos(&amp;InArray[0], (int)InArray.size(), threshold);
}

template&lt;typename T&gt;
int ArrayCenterPos(T * InArray, int size, T threshold)
{
...
}

int ArrayCenterPos(complex&lt;double&gt;* InArray, int size, double threshold)
{
...
}
</code></pre>
<p>ich bekomme aber den Fehler:</p>
<blockquote>
<p>1&gt;h:\Dev\CPP\SVN\modelocksimulation\ModelockingSimulation2\include\matthias\Common\ExtFunctions.h(325) : error C2664: 'int ArrayCenterPos(std::complex&lt;double&gt; *,int,double)' : cannot convert parameter 1 from 'const double *__w64 ' to 'std::complex&lt;double&gt; *'<br />
1&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />
1&gt; .\src\LaserData.cpp(130) : see reference to function template instantiation 'int ArrayCenterPos&lt;double&gt;(const std::vector&lt;_Ty&gt; &amp;,T)' being compiled<br />
1&gt; with<br />
1&gt; [<br />
1&gt; _Ty=double,<br />
1&gt; T=double<br />
1&gt; ]</p>
</blockquote>
<p>den ich nicht vetstehe.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1713547</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1713547</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Wed, 20 May 2009 21:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to template wählt falsche Funktion on Wed, 20 May 2009 23:17:19 GMT]]></title><description><![CDATA[<p>pospiech schrieb:</p>
<blockquote>
<p>... den ich nicht vetstehe.</p>
</blockquote>
<blockquote>
<p>1&gt;h:\Dev\CPP\SVN\modelocksimulation\ModelockingSimulation2\include\matthias\Common\ExtFunctions.h(325) : error C2664: 'int ArrayCenterPos(std::complex&lt;double&gt; *,int,double)' : cannot convert parameter 1 from 'const double *__w64 ' to 'std::complex&lt;double&gt; *'</p>
</blockquote>
<p>Ich denke du solltest in der Fehlermeldung ein besonderes Augenmerk auf das <strong>const</strong> legen, dann wird es vielleicht klarer. <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/1713561</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1713561</guid><dc:creator><![CDATA[Mitleid]]></dc:creator><pubDate>Wed, 20 May 2009 23:17:19 GMT</pubDate></item><item><title><![CDATA[Reply to template wählt falsche Funktion on Thu, 21 May 2009 07:31:05 GMT]]></title><description><![CDATA[<p>das Fehler mit const war mir noch nicht aufgefallen, aber der Grund für diese Fehlermeldung war schlicht eine fehlende Funktionsdeklaration...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1713599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1713599</guid><dc:creator><![CDATA[pospiech]]></dc:creator><pubDate>Thu, 21 May 2009 07:31:05 GMT</pubDate></item><item><title><![CDATA[Reply to template wählt falsche Funktion on Thu, 21 May 2009 09:37:58 GMT]]></title><description><![CDATA[<p>pospiech schrieb:</p>
<blockquote>
<p>Grund für diese Fehlermeldung war schlicht eine fehlende Funktionsdeklaration...</p>
</blockquote>
<p>Glaube ich zwar nicht, aber sei's drum ... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1713647</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1713647</guid><dc:creator><![CDATA[Mitleid]]></dc:creator><pubDate>Thu, 21 May 2009 09:37:58 GMT</pubDate></item></channel></rss>