Jump to content
  • Advertisement
Sign in to follow this  
zedzeek

stl::subset

This topic is 4519 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im wanting to find if a set of numbers is a subset of another set im pretty sure stl would have an equivilant algorithm but its doesnt seem to (unless ive missed it) the closest match i see is includes(...) but this has the added requirement that the sets need to be sorted ie the following example will return false A[] = {1,4,5,8,2}; B[] = {2,4,8}; includes( A.begin(),A.end(),B.begin(),B.end() ); ta zed

Share this post


Link to post
Share on other sites
Advertisement
What container are you using? If you use a std::set, then they'll already be ordered, thus, no problem.

Share this post


Link to post
Share on other sites
sorry im using std::vector<int>
thanks for the info about set though (i didnt know that) i may use it (though ild prefer not to change)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!