void make_vector_default( container & vec, const typename container::size_type & d1, const typename container::size_type & d2, Args... remaining_dims) { vec.clear(); vec.resize(d1); for(auto it=vec.begin(); it!=vec.end(); ++it) { make_vector_default(*it, d2, remaining_dims...); } }
void make_vector_function( container & vec, const func_type & func, const typename container::size_type & d1) { vec.clear(); vec.reserve(d1); typename container::size_type i(0); for(i=0; i<d1; ++i) { vec.push_back(func(i)); } }
vector_functioner(container & vec, const func_type & func, const other_container & other_vec) { const typename container::size_type i; auto new_func = [&] (Args... args) { return func(i,args...); }; vec.clear(); vec.reserve(other_vec.size()); for(i=0; i<other_vec.size(); ++i) { vector_functioner<d-1,decltype(vec[i]),decltype(new_func),decltype(other_vec[i])> (vec[i],new_func,other_vec[i]); } }
void make_vector_function( container & vec, const func_type & func, const typename container::size_type & d1, const typename container::size_type & d2, Args... remaining_dims) { vec.clear(); vec.resize(d1); typename container::size_type i(0); auto new_func = [&] (const typename container::size_type & i2, Args... remaining_is) { return func(i,i2,remaining_is...); }; for(auto it=vec.begin(); it!=vec.end(); ++it) { make_vector_function(*it, new_func, d2, remaining_dims...); ++i; } }
vector_defaulter(container & vec, const other_container & other_vec) { vec.clear(); vec.resize(other_vec); }
void make_vector_value( container & vec, const val_type & val, const typename container::size_type & d1) { vec.clear(); vec.resize(d1,val); }