Can't use enum class as unordered_map key

后端 未结 7 1402
后悔当初
后悔当初 2020-12-12 20:29

I have a class containing an enum class.

class Shader {
public:
    enum class Type {
        Vertex   = GL_VERTEX_SHADER,
        Geometry = GL_GEOMETRY_SHA         


        
7条回答
  •  眼角桃花
    2020-12-12 20:38

    When you use std::unordered_map, you know you need a hash function. For built-in or STL types, there are defaults available, but not for user-defined ones. If you just need a map, why don't you try std::map?

提交回复
热议问题