<?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[std::sort kann nicht kompiliert werden]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte gerne einen Vektor eines selbstgewählt struct sortieren. das sieht erst einmal wie folgt aus</p>
<pre><code class="language-cpp">struct poly
{
    float a, b, c, fDistance, fDeltaFInvSquare;
};
...
struct IsLessPredicate
{
    bool operator () ( poly &amp; elem1, poly &amp; elem2 )
    {
        return elem1.fDistance &lt; elem2.fDistance;
    }
};
...

bool method(...) {
    static vector&lt;poly&gt; polynomMap;
    ...
    std::sort(polynomMap.begin(),polynomMap.end(), IsLessPredicate());
}
</code></pre>
<p>leider kann gcc 3.4.5 dies nicht kompilieren und bringt folgenden Fehler</p>
<p>no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'<br />
raytrace line 124, external location: C:\mingw\include\c++\3.4.5\bits\stl_algo.h</p>
<p>Weiß jemand etwas damit anzufangen? Ich hatte das mal so programmiert und nun wollte ich das auf einem neueren GCC kompilieren lassen und es geht eben nicht mehr. Ich bin etwas ratlos.</p>
<p>Hier noch der Consolen-Auswurf</p>
<p><code>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h: In function</code>const _Tp&amp; std::__median(const _Tp&amp;, const _Tp&amp;, const _Tp&amp;, _Compare) [with _Tp = poly, _Compare = IsLessPredicate]':</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:2519:   instantiated from `void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator&lt;poly*, std::vector&lt;poly, std::allocator&lt;poly&gt; &gt; &gt;, _Size = int, _Compare = IsLessPredicate]'</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:2589:   instantiated from `void std::sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator&lt;poly*, std::vector&lt;poly, std::allocator&lt;poly&gt; &gt; &gt;, _Compare = IsLessPredicate]'</p>
<p>..\src\Blob.cpp:184:   instantiated from here</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:124: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:125: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:127: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:131: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:133: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>Build error occurred, build is stopped`</p>
<p>Ich würde mich freuen, wenn mir jemand helfen könnte?! Oder gibt es eine andere Lösung für diese Art der sortierung.. kenne nichts anderes.</p>
<p>Gruß lindner</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/270237/std-sort-kann-nicht-kompiliert-werden</link><generator>RSS for Node</generator><lastBuildDate>Sun, 30 Aug 2026 12:51:33 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/270237.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 08 Jul 2010 16:50:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::sort kann nicht kompiliert werden on Thu, 08 Jul 2010 16:50:35 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte gerne einen Vektor eines selbstgewählt struct sortieren. das sieht erst einmal wie folgt aus</p>
<pre><code class="language-cpp">struct poly
{
    float a, b, c, fDistance, fDeltaFInvSquare;
};
...
struct IsLessPredicate
{
    bool operator () ( poly &amp; elem1, poly &amp; elem2 )
    {
        return elem1.fDistance &lt; elem2.fDistance;
    }
};
...

bool method(...) {
    static vector&lt;poly&gt; polynomMap;
    ...
    std::sort(polynomMap.begin(),polynomMap.end(), IsLessPredicate());
}
</code></pre>
<p>leider kann gcc 3.4.5 dies nicht kompilieren und bringt folgenden Fehler</p>
<p>no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'<br />
raytrace line 124, external location: C:\mingw\include\c++\3.4.5\bits\stl_algo.h</p>
<p>Weiß jemand etwas damit anzufangen? Ich hatte das mal so programmiert und nun wollte ich das auf einem neueren GCC kompilieren lassen und es geht eben nicht mehr. Ich bin etwas ratlos.</p>
<p>Hier noch der Consolen-Auswurf</p>
<p><code>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h: In function</code>const _Tp&amp; std::__median(const _Tp&amp;, const _Tp&amp;, const _Tp&amp;, _Compare) [with _Tp = poly, _Compare = IsLessPredicate]':</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:2519:   instantiated from `void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator&lt;poly*, std::vector&lt;poly, std::allocator&lt;poly&gt; &gt; &gt;, _Size = int, _Compare = IsLessPredicate]'</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:2589:   instantiated from `void std::sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator&lt;poly*, std::vector&lt;poly, std::allocator&lt;poly&gt; &gt; &gt;, _Compare = IsLessPredicate]'</p>
<p>..\src\Blob.cpp:184:   instantiated from here</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:124: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:125: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:127: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:131: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>C:/mingw/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/bits/stl_algo.h:133: error: no match for call to `(IsLessPredicate) (const poly&amp;, const poly&amp;)'</p>
<p>..\src\Blob.cpp:90: note: candidates are: bool IsLessPredicate::operator()(poly&amp;, poly&amp;)</p>
<p>Build error occurred, build is stopped`</p>
<p>Ich würde mich freuen, wenn mir jemand helfen könnte?! Oder gibt es eine andere Lösung für diese Art der sortierung.. kenne nichts anderes.</p>
<p>Gruß lindner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1923422</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1923422</guid><dc:creator><![CDATA[lindner]]></dc:creator><pubDate>Thu, 08 Jul 2010 16:50:35 GMT</pubDate></item><item><title><![CDATA[Reply to std::sort kann nicht kompiliert werden on Thu, 08 Jul 2010 16:57:14 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">struct IsLessPredicate
{
    bool operator () ( const poly &amp; elem1, const poly &amp; elem2 ) const
    {
        return elem1.fDistance &lt; elem2.fDistance;
    }
};
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1923427</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1923427</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Thu, 08 Jul 2010 16:57:14 GMT</pubDate></item></channel></rss>