Skip to content

Commit 99e99cf

Browse files
committed
Aggregator documentation
1 parent 525d817 commit 99e99cf

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

inc/aggregators.hpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@
66
#include <tuple>
77
#include <type_traits>
88

9+
/**
10+
* \brief The namespace containing all of fpgen's code.
11+
*/
912
namespace fpgen {
13+
/**
14+
* \brief Aggregates all data in the generator to a dataset.
15+
*
16+
* The supplied container should support `push_back` (like most of the `std::`
17+
* containers). Each element is extracted from the generator and inserted into
18+
* the container. The container is not cleared before inserting. Elements
19+
* already extracted (due to previous calls to the generator, ...) cannot be
20+
* reconstructed.
21+
*
22+
* \tparam T The type contained in the container and generator.
23+
* \tparam Args Other parameters to be passed to the container.
24+
* \tparam Container The container type to output to.
25+
* \param[in, out] gen The generator to extract from.
26+
* \param[out] out The container to output to.
27+
* \returns A reference to the modified container.
28+
*/
1029
template <typename T, typename... Args,
1130
template <typename...> typename Container>
1231
Container<T, Args...> &aggregate_to(generator<T> &gen,
@@ -17,6 +36,22 @@ Container<T, Args...> &aggregate_to(generator<T> &gen,
1736
return out;
1837
}
1938

39+
/**
40+
* \brief Aggregates all data in the generator into an associative container.
41+
*
42+
* The supplied container should support `operator[]` (by reference, like
43+
* `std::map`). Duplicate key values will be be overwritten. The container is
44+
* not cleared before writing. Elements that have already been extracted from
45+
* the generator cannot be reconstructed.
46+
*
47+
* \tparam TKey The key type for the container.
48+
* \tparam TValue The value type for the container.
49+
* \tparam Args Other parameters to be passed to the container.
50+
* \tparam Container The container to be used.
51+
* \param[in, out] gen The generator to extract from.
52+
* \param[out] out The container to insert to.
53+
* \returns A reference to the modified container.
54+
*/
2055
template <typename TKey, typename TVal, typename... Args,
2156
template <typename...> typename Container>
2257
Container<TKey, TVal, Args...> &

0 commit comments

Comments
 (0)