0

A newbie question, but how to pass arguments into struct in c++ 11. I was always using c++ 14 where this method works. Today I am forced to use c++ 11 and I am stuck on this error;

error: no matching function for call to 'infinity::infinity(<brace-enclosed 
initializer list>)'return infinity{(x1 == x2), s};

My code:

struct infinity{
    bool yes = false;
    float m = 0;
};

infinity slope(float x1, float y1, float x2, float y2){
    float s = (y2-y1)/(x2-x1);
    return infinity{(x1 == x2), s};
}

Thanks!

0 Answers0