Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Stander Template Llibrary <algorithm>

Posted on 2004-04-06
2
Medium Priority
?
249 Views
Last Modified: 2010-04-01
Hello

I’m looking to study up on my STL (stander template library)
I got the containers down and most of the container adaptors.

What I’m looking for is a website that as a example of all the algorithm.

Like
Find()
Find_if()
Generate()
Genereate_n()



Thank you for your help
 
0
Comment
Question by:funvill
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
PerryDK earned 200 total points
ID: 10770272
http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/classref.htm

This contains all the links you will need.  It will example codes for nearly all the stl functions.  For example if you click on the find function who's url is

http://wwwasd.web.cern.ch/wwwasd/lhc++/RW/stdlibcr/fin_7988.htm

 it will have an example code with output as well for the find function such as

//
// find.cpp
//
 #include <vector>
 #include <algorithm>
 int main()
 {
   typedef vector<int>::iterator iterator;
   int d1[10] = {0,1,2,2,3,4,2,2,6,7};
   // Set up a vector
   vector<int> v1(d1,d1 + 10);
   // Try find  
   iterator it1 = find(v1.begin(),v1.end(),3);
   // it1 = v1.begin() + 4;
   // Try find_if
   iterator it2 =
      find_if(v1.begin(),v1.end(),bind1st(equal_to<int>(),3));
   // it2 = v1.begin() + 4
   // Try both adjacent_find variants
   iterator it3 = adjacent_find(v1.begin(),v1.end());
   // it3 = v1.begin() +2
   iterator it4 =
      adjacent_find(v1.begin(),v1.end(),equal_to<int>());
   // v4 = v1.begin() + 2
   // Output results
   cout << *it1 << " " << *it2 << " " << *it3 << " " 
        << *it4 << endl;
   return 0;
 }
Output : 3 3 2 2

0
 
LVL 2

Author Comment

by:funvill
ID: 10770311
perfect
thank you.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question