QWT API (English)
7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
src
core
qwt_algorithm.hpp
1
#ifndef QWT_ALGORITHM_HPP
2
#define QWT_ALGORITHM_HPP
3
#include <algorithm>
// std::find
4
#include <iterator>
// std::prev
5
37
template
<
typename
Iter >
38
Iter qwtSelectNextIterator(Iter begin, Iter end,
typename
std::iterator_traits< Iter >::value_type current,
bool
forward)
39
{
40
if
(begin == end) {
41
return
end;
42
}
43
44
Iter ite = std::find(begin, end, current);
45
46
if
(ite == end) {
47
ite = begin;
48
}
49
50
if
(forward) {
51
++ite;
52
if
(ite == end) {
53
ite = begin;
54
}
55
}
else
{
56
if
(ite != begin) {
57
--ite;
58
}
else
{
59
ite = std::prev(end);
60
}
61
}
62
63
return
ite;
64
}
65
66
#endif
// QWT_ALGORITHM_HPP
Generated by
1.9.8