c_-_13_-_stl_algorithms

c_-_13_-_stl_algorithms - Chapter 20 STL Algorithms STL...

Info iconThis preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 20 STL Algorithms
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
STL Algorithms Algorithms : Algorithms are function templates that manipulate data such as sorting, searching, and comparing elements in containers through iterators .
Background image of page 2
Iterators and Pointers Iterators are a generalization of pointers . Pointers themselves are iterators. So the array pointers can be treated as iterators. Iterators are often used with containers, but some iterators such as istream_iterator and ostream_iterator are not associated with containers at all.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Types of Algorithms The STL provides approximately 80 algorithms. The algorithms can be classified into four groups: Nonmodifying Algorithms Modifying Algorithms Numeric Algorithms Heap Algorithms
Background image of page 4
What is MSDN? MSDN is an acronym for the Microsoft Developer Network . MSDN provides up-to-date and comprehensive development resources so that developers can successfully develop solutions for Microsoft platforms and technologies. MSDN Library is a library of official technical documentation content intended for developers developing for Microsoft Windows.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
copy template < typename InputIterator , typename OutputIterator > OutputIterator copy( InputIterato r beg, InputIterator end, OutputIterator targetPostition)
Background image of page 6
copy
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
fill and fill_n template < typename ForwardIterator , typename T > void fill( ForwardIterator beg, ForwardIterator end, const T &value) template < typename ForwardIterator , typename size , typename T > void fill_n( ForwardIterator beg, size n, const T &value)
Background image of page 8
generate and generate_n template <typename ForwardIterator, typename function> void generate(ForwardIterator beg, ForwardIterator end, function gen) template < typename ForwardIterator, typename size, typename function> void generate_n(ForwardIterator beg, size n, function gen)
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
remove, remove_if template <typename ForwardIterator, typename T> ForwardIterator remove(ForwardIterator beg, ForwardIterator end, template <typename ForwardIterator, typename boolFunction> ForwardIterator remove_if(ForwardIterator beg, ForwardIterator end, boolFunction f)
Background image of page 10
remove, remove_if
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
remove, remove_if cout << "\nAfter the remove function, values: "; copy(values, remove(values, values + 10, 3), output); cout << "\nAfter the remove_if function, intList: "; copy(intList.begin(), remove_if(intList.begin(), intList.end(), greaterThan3), output);
Background image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 37

c_-_13_-_stl_algorithms - Chapter 20 STL Algorithms STL...

This preview shows document pages 1 - 13. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online