Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>g++</code> is actually correct here; you haven't declared <code>T</code> or <code>Allocator</code> in this scope. The template declaration you have</p> <pre><code>template&lt;template &lt;class T, class Allocator&gt; class listPlaceholder&gt; void function(std::list&lt;T, Allocator&gt; param) </code></pre> <p>Says "I am parameterized over a class template that takes in two classes as arguments." However, the names of those arguments can't be accessed anywhere in the body of the template. They're mostly there as placeholders, and the above template declaration is equivalent to</p> <pre><code>template&lt;template &lt;class, class&gt; class listPlaceholder&gt; void function(std::list&lt;T, Allocator&gt; param) </code></pre> <p>This is similar to how if you were to declare a regular C++ function that took another function as an argument, you can't access the names of the parameters. For example, this is illegal:</p> <pre><code>void DoSomething(void function(int x, int y)) { x = 5; // Error! } </code></pre> <p>Since it's equivalent to</p> <pre><code>void DoSomething(void function(int, int)) { x = 5; // Error! } </code></pre> <p>I believe what you want to do is change your template function signature to look like this:</p> <pre><code>template&lt;class T, class Allocator&gt; void function(std::list&lt;T, Allocator&gt; param) </code></pre> <p>This says "This function is parameterized over two types. When provided as an argument a <code>std::list</code> parameterized over a type and an allocator, the body of this function can refer to those types as <code>T</code> and <code>Allocator</code>."</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

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