Hi,
I've just got over an hour long compile error. I fixed it, but I dont understand why. Can anyone help explain.
// Triangle is a nested class with-in this class
vector<Triangle> Triangles;
...
d:\Test\Test.cpp(85) : error C2440: 'return' : cannot convert from 'const std::allocator<_Ty>::value_type *__w64 ' to 'TriangleCollection::Triangle *'
with
[
_Ty=Triangulate2D::Triangle
]
Conversion loses qualifiers
If i remove the const then it compiles ok.
Thanks.
I've just got over an hour long compile error. I fixed it, but I dont understand why. Can anyone help explain.
// Triangle is a nested class with-in this class
vector<Triangle> Triangles;
...
Code:
inline Triangle* get_Triangle(UINT Index) const {
if (Index >= 0 && Index < Triangles.size())
return &Triangles[Index]; // C2440
else
return NULL;
}
d:\Test\Test.cpp(85) : error C2440: 'return' : cannot convert from 'const std::allocator<_Ty>::value_type *__w64 ' to 'TriangleCollection::Triangle *'
with
[
_Ty=Triangulate2D::Triangle
]
Conversion loses qualifiers
If i remove the const then it compiles ok.
Thanks.