3 #include "utilities/aligned/vector.h" 5 #include <experimental/optional> 16 template <
typename It,
typename Func>
17 void push(It b, It e,
const Func& func) {
18 const auto input_size = std::distance(b, e);
19 const auto num_items = get_num_items();
20 if (input_size != num_items) {
21 throw std::runtime_error{
22 "Incorrect range size passed to iterative_builder."};
25 for (
auto i = 0ul; i != num_items; ++i) {
26 push_item(i, func(b[i]));
30 template <
typename It>
31 void push(It b, It e) {
32 push(b, e, [](
const auto& i) ->
const auto& {
return i; });
35 const auto& get_data()
const {
return data_; }
36 auto& get_data() {
return data_; }
38 auto get_num_items()
const {
return data_.size(); }
41 void push_item(
size_t index, T item) {
42 data_[index].emplace_back(std::move(item));
44 void push_item(
size_t index,
const std::experimental::optional<T>& item) {
46 push_item(index, *item);
50 util::aligned::vector<util::aligned::vector<T>> data_;
Definition: iterative_builder.h:11
Definition: pressure.h:22
Definition: capsule_base.h:9