hello my question is, How do you sort a vector containing a bunch of game_object* 's ? You can use STD's algorithm.sort() somehow ... right ?
wwsoft 0 Light Poster
Recommended Answers
Jump to PostYes, you could use sort( ), provided you provide a comparison function.
Jump to Posthow do you create one ?
Im trying to sort objects by their z
You might have something as simple as
// Compares two game objects by 'z' bool game_obj_compare(const game_obj * lhs, const game_obj * rhs) { return lhs->z < rhs->z; } // To sort a …
All 5 Replies
Fbody 682 Posting Maven Featured Poster
vmanes 1,165 Posting Virtuoso
wwsoft 0 Light Poster
Fbody 682 Posting Maven Featured Poster
mitrmkar 1,056 Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.