CARMA C++
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
combinatorics.h
1
#ifndef CARMA_UTIL_COMBINATORICS_H
2
#define CARMA_UTIL_COMBINATORICS_H
3
4
5
namespace
carma {
6
namespace
util {
7
8
9
int
sumOf1ToN(
int
n );
10
11
12
}
// namespace carma::util
13
}
// namespace carma
14
15
16
inline
int
17
carma::util::sumOf1ToN(
const
int
n )
18
{
19
// NOTE: I assume I don't overflow the size of an int with the product
20
return
((n * (n + 1)) / 2);
21
}
22
23
24
#endif
carma
util
combinatorics.h
Generated by
1.8.5