mardi 28 février 2017

Creating a set of sets of objects in C++

I am trying to create a set of set of objects, but am having an error message with how I use the -> with iterator k. I think I have to define some overloaded operators before I use this? I can't seem to find any resources online about my specific problem.

My error message is

no instance of overloaded function "std::set<_Kty, _Pr, _Alloc>::insert [with _Kty=Triangles, _Pr=std::less<Triangles>, _Alloc=std::allocator<Triangles>]" matches the argument list and object (the object has type qualifiers that prevent a match)

std::set<std::set<Triangles>>::iterator k;
for (k = setofTriangles.begin(); k != setofTriangles.end(); k++) {
    double v1query = k -> begin() -> getV1()[1];
    double v2query = k -> begin() -> getV2()[1];
    double v3query = k -> begin() -> getV3()[1];

    double iterYMax = std::max(v1query, std::max(v2query,v3query));             
    if (iterYMax == triangleYMax) {
        k -> insert(addTriangle);
    }
}

Please let me know if you need more information. Thank you.

Aucun commentaire:

Enregistrer un commentaire