[LLVMbugs] [Bug 10139] unordered_set declared inside class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 15 06:39:54 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=10139

Howard Hinnant <hhinnant at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Howard Hinnant <hhinnant at apple.com> 2011-06-15 08:39:53 CDT ---
std::hash<FlowGraph::Register> is not a complete type.  Either you need to
define std::hash<FlowGraph::Register> before you use it.  Or you need to define
and use another hash function.  For example:


class FlowGraph
{
  public:
    typedef unsigned int RegisterId;

    class Register
    {
      public:
        RegisterId _id;

        Register( RegisterId id = 0 ) : _id(id) { }

        bool operator==( const Register& r ) const
        {
          return _id == r._id;
        }

        std::size_t hash() const {return _id;}
    };

    struct hash
    {
        std::size_t operator()(const Register& r) const
            {return r.hash();}
    };

    typedef std::unordered_set< Register, hash > RegisterSet;

    private:
      RegisterSet _In;
};

Closing as "not a bug".

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list