Remove object from list by identity
<p>In the following example a std::list stores objects of type Resource (by value, not pointing to). The Resource class does not provide a less than comparison nor equality operator. What is a good way to remove an object by identity (aka memory address). Can i avoid O(n) somehow? Is std::list the right container?</p>

<pre><code>// Definition of the container
std::list&lt;Resource&gt; resources;

// Code
Resource *closedResource = resourceFromList();
for (std::list&lt;Resource&gt;::iterator it = resources.begin(); it != resources.end(); ++it)
{
    if (closedResource == &amp;*it)
    {
        resources.erase(it);
        break;
    }
}
</code></pre>

<p><strong>Edit:</strong> Assume that the Resource class implements move semantic. Furthermore the Resource reregisters itself for any "movement" by a kind of Selector (cp. epoll or java.nio.Selector) for event notifications.</p>
