Example program to test permutations (JTOOLS::next_permutation).
More...
#include <string>
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <algorithm>
#include "JTools/JPermutation.hh"
#include "JMath/JMathSupportkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
Go to the source code of this file.
|
| int | main (int argc, char **argv) |
| |
Example program to test permutations (JTOOLS::next_permutation).
- Author
- mdejong
Definition in file JPermutation.cc.
◆ main()
| int main |
( |
int | argc, |
|
|
char ** | argv ) |
Definition at line 22 of file JPermutation.cc.
23{
25
27 unsigned int N;
29
30 try {
31
32 JParser<> zap(
"Example program to test permutations.");
33
37
38 zap(argc, argv);
39 }
40 catch(const exception &error) {
41 FATAL(error.what() << endl);
42 }
43
44
46
47
48 if (N > buffer.size()) {
49 FATAL(
"Number of elements " << N <<
" > " << buffer.size() <<
endl);
50 }
51
52 sort(buffer.begin(), buffer.end(),
less<int>());
53
55
57
59
61
62 do {
63
65
67
70 }
71
73
75 data.rbegin()->insert(*i);
76 }
77
79
82 }
83
85
87
88
92 }
93 }
94
95
97
99}
#define DEBUG(A)
Message macros.
#define ASSERT(A,...)
Assert macro.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Template definition of a multi-dimensional oscillation probability interpolation table.
Utility class to parse command line options.
long long int factorial(const long long int n)
Determine factorial.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.