lundi 7 décembre 2015

How to fill const std::array

How to create const std::array containing following values f(0), f(1), ..., f(N-1) where f is any function: size_t f(int index)? When I know exactly N I can obviously write

std::array<size_t, 5> a = {f(0), f(1), f(2), f(3), f(4)}

Aucun commentaire:

Enregistrer un commentaire