Access glm::vec3 component by argument?

Is there a way to access one component of a glm vector by argument?


bool greaterThan( const glm::vec3& lhs, const glm::vec3& rhs, const Axis axis )
    return lhs.component( axis ) > rhs.component( axis );

Yes. You use [] with an integer. As in lhs[axis], where axis is an integer.