STL学习笔记一

STL学习笔记一
/*
exception handler

*/
   class El;
   class E2;


   void f() throw(E1, std::bad_exception)
                          //throws exception of type El or
                          //bad_exception for any other exception type
   {
      ...
      throw El();         //throws exception of type El
      ...
      throw E2();         //calls unexpected(), which throws bad_exception
   }
       

/*
numeric limits
*/

      cout << "max(short): " << numeric_limits<short>::max() << endl;
      cout << "max(int): " << numeric_limits<int>::max() << endl;
      cout << "max(long): " << numeric_limits<long>::max() << endl;


/*
container
*/
1.bmp

/*
algorithm

*/


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

using namespace std;

void print(int num)
{
    cout<<num<<endl;
}
int main()
{
    vector<int> list(20);
    generate(list.begin(),list.end(),rand);
    for_each(list.begin(),list.end(),print);
    cout<<" finish . press <<enter>> to exit "<<endl;
    cin.get();
}

你可能感兴趣的:(STL学习笔记一)