vectors of references to objects
<p>is it legal to have a vector of references to objects, like this:</p>

<pre><code>vector&lt;Agent&amp;&gt; seenAgents;
</code></pre>

<p>which would for example be populated by some, but not all of the objects in the scene?</p>

<p>I have a vector of Agent objects, but the vector outlined above should hold references to only the one's each agent can currently see - meaning that the references will be being added and removed all the time.</p>

<p>Is this something the language will allow? And in addition, is there anything else I need to be aware of? If I remove a reference from the vector does it persist anywhere? Is it a memory leak?</p>

<p>I seem to be getting this error on the line declaring the vector:</p>

<pre><code>error C2528: 'pointer' : pointer to reference is illegal
</code></pre>

<p>Is this something directly to do with the line or is it most likely occurring somewhere else? It's being initialised in the constructors initialiser list like this:</p>

<pre><code>seenAgents(vector&lt;Agents&amp;&gt;())
</code></pre>
