heightmapIsland::heightmapIsland(std::list<heightmapTile> &usedList)
{
std::list<heightmapIsland> pendingIslands;
heightmapTile firstTile = usedList.front();
std::list<heightmapTile> firstTileList = std::list<heightmapTile>{ firstTile };
std::list<heightmapTile> firstChain = firstTile.allConnected( firstTileList, std::pair<int, int>(0, 0));
heightmapIsland firstIsland = heightmapIsland();
firstIsland.tiles = firstChain;
pendingIslands.emplace_back( firstIsland );
for (heightmapTile usedTile : firstIsland.tiles)
{
usedList.remove(usedTile);
}
while (usedList.size() > 0)
{
for (heightmapIsland &island : pendingIslands)
{
for (heightmapTile tile : island.tiles)
{
}
}
}
}```
When I try writing code, and specifically adding the usedList.remove(usedTile) it tells me "binary '==': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator" I did however overload the == operator for the heightmapTile class that would return true if two are the same, even if they're memory isn't. I'm trying to do it based on address/instance though.
#Unable to remove from std::list
1 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
Show the full error message.
binary '==': 'const _Ty' does not define this operator or a conversion to a type acceptable to the predefined operator
View in the Output window.
I don't see your == overload listed.
bool operator==(heightmapTile A, heightmapTile B)
{
return A.southLat() == B.southLat() &&
A.northLat() == B.northLat() &&
A.westLong() == B.westLong() &&
A.eastLong() == B.eastLong();
}```
Is this visible where you are using it?
I believe so.
Do I need to write another class just to do all this by now?
Don't believe, check and be absolutely certain.
Try with this signature:
bool operator==(const heightmapTile & A, const heightmapTile & B)
or add
bool operator==(const heightmapTile & other) const
to your class heightmapTile
I'll try that.
I did now I get the object has type qualifiers that are not compatible with the member function "heightmapTile::northLat"
Add const to function northLat southLat and so on.
Is the fact that you're copying both heightmapTiles intentional? Looks like it should be heightmapTile& or const heightmapTile&
ah nvm, someone said that already, mb

