News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

C++ Standard Library Functions

Started by sukishan, Jul 10, 2009, 10:06 PM

Previous topic - Next topic

sukishan

C++ Standard Library Functions

Many C++ standard library functions operate on sequences denoted by iterators or pointers. Iterators are a family of types that include pointers. They are classified by the operators they support.

input: ++p, p++, p=q, p==q, p!=q, *p (read-only)
output: p=q, p==q, p!=q, *p++ = x (alternating write/increment)
forward: input and output and p->m, *p (multiple read-write)
bidirectional: forward and --p, p--, implemented by list, map, multimap, set, multiset.
random: bidirectional and p<q, p>q, p<=q, p>=q, p+i, i+p, p-i, p-q, p, implemented by arrays (as pointers), string, vector, deque.
Some algorithms require certain iterator types, but will accept more powerful types. For example, copy(b, e, d) require b and e to be at least input iterators and d to be at least an output iterator. But it will accept forward, bidirectional, or random iterators because these all support input and output operations. sort() requires random iterators and will accept no other type.

The notation [b,e) denotes the sequence of e-b objects from b[0] to e[-1], i.e. b points to the beginning of the sequence and e points one past the end. For most containers, v, the sequence is [v.begin(), v.end()). For an array of n elements, the sequence is [a, a+n).
A good beginning makes a good ending

Quick Reply

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it has been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S post or ALT+P preview