
15 Oct
2016
15 Oct
'16
10:15 p.m.
On 10/15/2016 04:06 PM, Larry Evans wrote:
template<std::size_t N, typename... Fields> using soa_citizens_t= std::tuple < std::array<N,Fields>... > ;
? Then wouldn't:
std::size_t n=5; soa_citizens_t<n,string,string,int,int> soa_citizens; int avg = 0; int t = 1; std::size_t const salary=2 for( int salary: get<salary>(soa_citizens)) { avg += (salary - avg) / t; ++t; }
FWIW, the attached compiles and runs with: clang version 3.8.0 (tags/RELEASE_380/final) on my ubuntu OS.