Adobe Source Libraries
2.0.0
A collection of C++ libraries.
Loading...
Searching...
No Matches
permutation.hpp
Go to the documentation of this file.
1
/*
2
Copyright 2013 Adobe
3
Distributed under the Boost Software License, Version 1.0.
4
(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
*/
6
/**************************************************************************************************/
7
8
#ifndef ADOBE_ALGORITHM_PERMUTATION_HPP
9
#define ADOBE_ALGORITHM_PERMUTATION_HPP
10
11
#include <
adobe/config.hpp
>
12
13
#include <boost/range/begin.hpp>
14
#include <boost/range/end.hpp>
15
16
#include <algorithm>
17
#include <functional>
18
19
/**************************************************************************************************/
20
21
namespace
adobe
{
22
23
/**************************************************************************************************/
32
/**************************************************************************************************/
38
template
<
class
B
id
irectionalRange>
39
inline
bool
next_permutation
(BidirectionalRange& range) {
40
return
std::next_permutation(boost::begin(range), boost::end(range));
41
}
42
48
template
<
class
B
id
irectionalIterator,
class
Compare>
49
inline
bool
next_permutation
(BidirectionalIterator first, BidirectionalIterator last,
50
Compare comp) {
51
return
std::next_permutation(first, last,
52
std::bind(comp, std::placeholders::_1, std::placeholders::_2));
53
}
54
60
template
<
class
B
id
irectionalRange,
class
Compare>
61
inline
bool
next_permutation
(BidirectionalRange& range, Compare comp) {
62
return
adobe::next_permutation
(boost::begin(range), boost::end(range), comp);
63
}
64
70
template
<
class
B
id
irectionalRange>
71
inline
bool
prev_permutation
(BidirectionalRange& range) {
72
return
std::prev_permutation(boost::begin(range), boost::end(range));
73
}
74
80
template
<
class
B
id
irectionalIterator,
class
Compare>
81
inline
bool
prev_permutation
(BidirectionalIterator first, BidirectionalIterator last,
82
Compare comp) {
83
return
std::prev_permutation(first, last,
84
std::bind(comp, std::placeholders::_1, std::placeholders::_2));
85
}
86
92
template
<
class
B
id
irectionalRange,
class
Compare>
93
inline
bool
prev_permutation
(BidirectionalRange& range, Compare comp) {
94
return
adobe::prev_permutation
(boost::begin(range), boost::end(range), comp);
95
}
96
97
/**************************************************************************************************/
98
99
}
// namespace adobe
100
101
/**************************************************************************************************/
102
103
#endif
104
105
/**************************************************************************************************/
config.hpp
adobe::next_permutation
bool next_permutation(BidirectionalRange &range)
permutation implementation
Definition
permutation.hpp:39
adobe::prev_permutation
bool prev_permutation(BidirectionalRange &range)
permutation implementation
Definition
permutation.hpp:71
adobe
Definition
class_template.hpp:7
adobe
algorithm
permutation.hpp
Generated by
1.14.0