\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.13 - STL Extensions for CGAL

Functions

template<class InputIterator , class Size , class OutputIterator >
OutputIterator CGAL::copy_n (InputIterator first, Size n, OutputIterator result)
 
template<class ForwardIterator >
std::pair< ForwardIterator, ForwardIteratorCGAL::min_max_element (ForwardIterator first, ForwardIterator last)
 Computes the minimal and the maximal element of a range. More...
 
template<class ForwardIterator , class CompareMin , class CompareMax >
std::pair< ForwardIterator, ForwardIteratorCGAL::min_max_element (ForwardIterator first, ForwardIterator last, CompareMin comp_min, CompareMax comp_max)
 Computes the minimal and the maximal element of a range. More...
 
template<class BidirectionalIterator >
BidirectionalIterator CGAL::predecessor (BidirectionalIterator it)
 
template<class ForwardIterator >
ForwardIterator CGAL::successor (ForwardIterator it)
 
template<typename ForwardIterator >
Iterator CGAL::cpp11::next (ForwardIterator it)
 The function returns the result of operator++ on a ForwardIterator. More...
 
template<typename BidirectionalIterator >
Iterator CGAL::cpp11::prev (BidirectionalIterator it)
 The function returns the result of operator-- on a BidirectionalIterator. More...
 
template<class InputIterator , class Size , class OutputIterator >
OutputIterator CGAL::cpp11::copy_n (InputIterator first, Size count, OutputIterator result)
 Copies n items from an input iterator to an output iterator. More...
 
template<class RandomAccessIterator , class RandomGenerator >
void CGAL::cpp98::random_shuffle (RandomAccessIterator begin, RandomAccessIterator end, RandomGenerator &random)
 Replacement for std::random_shuffle() which was deprecated in C++14, and removed by C++17. More...
 
template<class RandomAccessIterator >
void CGAL::cpp98::random_shuffle (RandomAccessIterator begin, RandomAccessIterator end)
 Replacement for std::random_shuffle() which was deprecated in C++14, and removed by C++17. More...
 

Function Documentation

◆ copy_n() [1/2]

template<class InputIterator , class Size , class OutputIterator >
OutputIterator CGAL::copy_n ( InputIterator  first,
Size  n,
OutputIterator  result 
)

#include <CGAL/algorithm.h>

Deprecated:
This function is deprecated, CGAL::cpp11::copy_n should be used instead.

Copies the first n items from first to result.

Returns
the value of result after inserting the n items.
Note
The STL release June 13, 1997, from SGI contains an equivalent function, but it is not part of the ISO standard.
See also
CGAL::Counting_iterator<Iterator, Value>

copies

◆ copy_n() [2/2]

template<class InputIterator , class Size , class OutputIterator >
OutputIterator CGAL::cpp11::copy_n ( InputIterator  first,
Size  count,
OutputIterator  result 
)

#include <CGAL/algorithm.h>

Copies n items from an input iterator to an output iterator.

Its exact behaviour is defined in Paragraph 25.3.1 of the C++ standard draft N3242.

Note
This provides an implementation of the standard function copy_n from the C++0x standard. If copy_n is available in the std:: namespace a using declaration is used, otherwise an alternative implementation from CGAL is used.

◆ min_max_element() [1/2]

template<class ForwardIterator >
std::pair<ForwardIterator, ForwardIterator > CGAL::min_max_element ( ForwardIterator  first,
ForwardIterator  last 
)

#include <CGAL/algorithm.h>

Computes the minimal and the maximal element of a range.

It is modeled after the STL functions std::min_element and std::max_element. The advantage of min_max_element compared to calling both STL functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences.

Example

The following example program computes the minimal and maximal element of the sequence (3,\,6,\,5). Hence the output is min = 3, max = 6.


File STL_Extension/min_max_element_example.cpp

#include <CGAL/algorithm.h>
#include <vector>
#include <iostream>
using std::vector;
using std::pair;
using std::cout;
using std::endl;
int main()
{
vector< int > v;
v.push_back(3);
v.push_back(6);
v.push_back(5);
typedef std::vector< int >::iterator iterator;
pair< iterator, iterator > p = min_max_element(v.begin(), v.end());
cout << "min = " << *p.first << ", max = " << *p.second << endl;
return 0;
}
Returns
a pair of iterators where the first component refers to the minimal and the second component refers to the maximal element in the range [first, last). The ordering is defined by operator< on the value type of ForwardIterator.
Examples:
STL_Extension/min_max_element_example.cpp.

◆ min_max_element() [2/2]

template<class ForwardIterator , class CompareMin , class CompareMax >
std::pair< ForwardIterator, ForwardIterator > CGAL::min_max_element ( ForwardIterator  first,
ForwardIterator  last,
CompareMin  comp_min,
CompareMax  comp_max 
)

#include <CGAL/algorithm.h>

Computes the minimal and the maximal element of a range.

It is modeled after the STL functions std::min_element and std::max_element. The advantage of min_max_element compared to calling both STL functions is that one only iterates once over the sequence. This is more efficient especially for large and/or complex sequences.

Returns
a pair of iterators where the first component refers to the minimal and the second component refers to the maximal element in the range [first, last).
Template Parameters
CompareMinis an adaptable binary function object: VT \( \times\) VT \( \rightarrow\) bool where VT is the value type of ForwardIterator.
CompareMaxis an adaptable binary function object: VT \( \times\) VT \( \rightarrow\) bool where VT is the value type of ForwardIterator.

◆ next()

template<typename ForwardIterator >
Iterator CGAL::cpp11::next ( ForwardIterator  it)

#include <CGAL/algorithm.h>

The function returns the result of operator++ on a ForwardIterator.

The exact behaviour is described in Paragraph 24.4.4 of the C++ standard draft N3242.

Note
There is actually no function in namespace CGAL::cpp11 with this name, but a using declaration which imports a function from another namespace. By order of priority: the one in namespace std is used (provided by C++0x), if not found, then the one in namespace boost is used.
See also
boost::next
CGAL::cpp11::prev()

◆ predecessor()

template<class BidirectionalIterator >
BidirectionalIterator CGAL::predecessor ( BidirectionalIterator  it)

#include <CGAL/algorithm.h>

Deprecated:
This function is deprecated.

CGAL::cpp11::prev should be used instead.

Returns the previous iterator, i.e. the result of operator-- on a bidirectional iterator.

See also
CGAL::successor()
Returns
--it.

◆ prev()

template<typename BidirectionalIterator >
Iterator CGAL::cpp11::prev ( BidirectionalIterator  it)

#include <CGAL/algorithm.h>

The function returns the result of operator-- on a BidirectionalIterator.

The exact behaviour is described in Paragraph 24.4.4 of the C++ standard draft N3242.

Note
If C++0x is available the function std::prev is imported into the namespace CGAL::cpp11, otherwise CGAL::cpp11::prev is declared with the signature as given in Paragraph 24.4.4 of the ISO C++ Standard and forwarded to boost::prior.

◆ random_shuffle() [1/2]

template<class RandomAccessIterator , class RandomGenerator >
void CGAL::cpp98::random_shuffle ( RandomAccessIterator  begin,
RandomAccessIterator  end,
RandomGenerator &  random 
)

#include <CGAL/algorithm.h>

Replacement for std::random_shuffle() which was deprecated in C++14, and removed by C++17.

In the STL it was replaced by std::shuffle().

Note
The implementation in CGAL produces the same order on all platforms.

◆ random_shuffle() [2/2]

template<class RandomAccessIterator >
void CGAL::cpp98::random_shuffle ( RandomAccessIterator  begin,
RandomAccessIterator  end 
)

#include <CGAL/algorithm.h>

Replacement for std::random_shuffle() which was deprecated in C++14, and removed by C++17.

In the STL it was replaced by std::shuffle().

Note
The implementation in CGAL produces the same order on all platforms.

◆ successor()

template<class ForwardIterator >
ForwardIterator CGAL::successor ( ForwardIterator  it)

#include <CGAL/algorithm.h>

Deprecated:
This function is deprecated.

CGAL::cpp11::next should be used instead.

Returns the next iterator, i.e. the result of operator++ on a forward iterator.

See also
CGAL::predecessor()
Returns
++it.