ciao.
ho la seguente struttura cheserve per fare il sort di un immagine sapendo la larghezza e l'altezza:
questa il semplice istruzione che fa il sort di un a mappa
codice:for ( fmSort = formatMap.begin(); fmSort != formatMap.end(); ++fmSort) std::sort( (*fmSort).second.begin(), (*fmSort).second.end(), Texture2DGreater() );test:codice:typedef struct _TEXTURE { bool operator()(Texture2D const *s1, Texture2D const *s2) const { if (s1->GetHeight()*s1->GetWidth() > s2->GetHeight()*s2->GetWidth()) return true; else if ( (s1->GetHeight() > s2->GetHeight()) && (s1->GetHeight()*s1->GetWidth() == s2->GetHeight()*s2->GetWidth())) return true; else if ( (s1->GetWidth() > s2->GetWidth()) && (s1->GetHeight()*s1->GetWidth() == s2->GetHeight()*s2->GetWidth())) return true; else return false; } } Texture2DGreater;
di questa immagine viene fatto il sort tranquillamentecodice:s1->GetHeight() = 1024 s2->GetHeight = 512 s1->GetWidth() = 512; s2->GetWidth() = 1024;
ma
codice:s1->GetHeight() = 512 s2->GetHeight = 1024 s1->GetWidth() = 1024; s2->GetWidth() = 512;
e qui mi ritorna un errore.
a cosa è dovuto?
ho visto che ci sono gia texture con le stesse dimensioni e penso che l'errore sia dovuto al fatto che per una texture did stesse deimensioni la struct di comparazione mi ritorna due bool uguali?
vorrei capire a fondo la situzione e , si anche correggerlo , ma capire bene il perchè.
grazie.

Rispondi quotando