Note that there are some explanatory texts on larger screens.

plurals
  1. POTemplate arguments to template functions
    text
    copied!<p>I just released a skiplist container library. And the Sun compiler complains about this:</p> <pre><code>template &lt;class T, class R&gt; bool operator==(const IndexedSkipList&lt;T,R&gt; &amp;left, const IndexedSkipList&lt;T,R&gt; &amp;right) { return ((left.size() == right.size()) &amp;&amp; (std::equal(left.begin(), left.end(), right.begin()))); } </code></pre> <p>The errors are:</p> <pre><code>"include/CSIndexedSkipList.h", line 65: Error: Too few arguments for template std::reverse_iterator&lt;CS::BidiIdxIterator&lt;CS::IndexedSkipList&lt;CS::T, CS::R&gt;&gt;&gt;. "include/CSIndexedSkipList.h", line 207: Where: While specializing "CS::IndexedSkipList&lt;CS::T, CS::R&gt;". "include/CSIndexedSkipList.h", line 207: Where: Specialized in non-template code. </code></pre> <p>The code above is what starts at 207. But it seems that it's complaining about the reverse_iterator. I can't really make sense of it. I don't have direct access to the Sun compiler, so I was wondering if I'm doing something wrong.</p> <p>Also, I'm only using one template argument in reverse_iterator, but I noticed the SGI documentation saying that there is no default for the second argument T. Everywhere I've looked though, they just use this:</p> <pre><code>typedef std::reverse_iterator&lt;iterator&gt; reverse_iterator; </code></pre> <p>That's line 65 that the compiler complains about. Do I need to add T as a parameter? I can't figure out the error in question.</p> <p>BTW, this works on gcc on all platforms I could find. And it works in Borland as well.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload