C ++ function usage Summary/programming considerations

Source: Internet
Author: User

1. stable_partition: stable division and unstable division.

# Include <iostream> # include <algorithm> # include <vector> using namespace STD; struct student {char name [20]; int age ;}; ostream & operator <(ostream & OS, const student & S) {OS <"(" <S. name <"" <S. age <")"; return OS;} bool agecom (student & S) {return S. age <30 ;}int main (INT argc, char * argv []) {student STU [] ={{ "zhangsan", 29 },{ "Lisi", 57 }, {"wangwu", 49 },{ "zhaoliu", 27 }}; copy (Stu, Stu + 4, ostream_iterator <student> (cout ,"")); cout <Endl; // an unstable division vector <student> VEC (Stu, Stu + 4); partition (VEC. begin (), VEC. end (), agecom); copy (VEC. begin (), VEC. end (), ostream_iterator <student> (cout, ""); cout <Endl; // stable division vector <student> vec2 (Stu, Stu + 4 ); stable_partition (vec2.begin (), vec2.end (), agecom); copy (VEC. begin (), VEC. end (), ostream_iterator <student> (cout, ""); cout <Endl ;}

  

2. Trace macro

Trace is not a function but a macro. It is used to generate messages from your program in the output window of the debugger.

It works only in debug mode. It is useless in release mode. You can regard it as a printf statement, but this statement automatically disappears in release mode.

 

3. STL containers

The method in 3.1 list is as follows:

 

 

Updating...

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.