|
Boost : |
Subject: Re: [boost] interest in structure of arrays container?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2016-10-15 18:15:54
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk