STL Standard Template Library

Source: Internet
Author: User

<vector> variable-length arrays

Vector<int>v int is a template parameter, so it will be int

V.push_back (a) passes a into V and is placed in the last

V.clear ()

V.size ()

V.begin () V.end () is an iterator, similar to a pointer, that returns the start and end addresses of V

V[n] Returns the element with position N in V


<map>

Map<key,value> a type to another type of mapping

Map<string,int>month_name month_name["July"]=7 such a way to assign values

The map also provides [] so that the map can be used like an array

Logn access time, discrete data


<set> Collection

Set<int>s

S.insert (1) Only one 1 is kept in a collection


<queue> queues

Queue<int>q

Q.push (a) A will be placed at the end

The first of the Q.pop () queue is ejected and will be deleted

Q.size ()

Q.front () accesses the first of a queue


<algorithm>

Min ()

Max ()

Sort (a,a+n) from small to large a[0] to A[n]

Find key in Find (A,a+n,key) a[0] to A[n]


<stack> Stacks

Q.push ()

Q.pop ()

Q.top ()

Q.empty () determines if the stack is empty and returns ture

Operator overloading can be redefined <


CString

Memset (starting unit, assigned value, end unit)

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.