use std::array and iterators