Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Freaker13

std::find

This topic is 5449 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

Hi all, When i use std::find, i get the error: error C2039: ''find'' : is not a member of ''std''. i''m using vs6.0. thx in advance

Share this post


Link to post
Share on other sites
Advertisement
Shouldn''t you be using something like std::map::find or std::set::find?
find is a member function of these (and other) STL templates.

Share this post


Link to post
Share on other sites
quote:
Original post by Strewth
Shouldn't you be using something like std::map::find or std::set::find?
find is a member function of these (and other) STL templates.

Indeed, std::map has an overloaded find() public member function. Freaker13 , though, is talking about std::find(), which is one of the [search/non-mutating] generic algorithms (a set of independent functions). For example:

#include <vector>
#include <algorithm>
#include <string>
#include <iostream>

...

std::vector<std::string> V(..., ...);

std::sort( V.begin(), V.end() ); // generic algorithm `sort'


// (yes, could, and probably would, be put in if statement)

std::vector<int>::iterator found = std::find( V.begin(), V.end(), "word" ); // generic algorithm `found'

if ( found != V.end() )
std::cout << "found" << std::endl;
else
std::cout << "not found" << std::endl;

std::rotate( V.begin(), V.begin() + V.size() / 2, V.end() ); // generic algorithm `rotate'


std::reverse( V.begin(), V.end() ); // generic algorithm `reverse'


... etc., etc.


[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on August 16, 2003 8:34:59 AM]

Share this post


Link to post
Share on other sites

  • 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!