Chris Forone <
4o...@gmx.at> wrote in news:kn78r4$s38$1
@
newsreader2.utanet.at:
You mean, "addresses of array elements"?
In general, std::array is designed to be a minimal overhead replacement
for C arrays, so one ought to expect the runtime overhead (over a C-style
array) of an indexing operation is zero or negligible. However, this
depends on the compiler, compiler options and other settings, most
importantly on the optimization level and so-called checked iterator
support.
Anyway, any runtime overhead is probably not measurable here. I would
worry more about avoiding undefined behavior in your code, &arya[4] is an
illegal operation if the array only contains 4 elements, one should
instead use arya.end() or at least arya.data()+4. If there is a
possibility that the array is empty, then also &arya[0] becomes an
illegal operation and should be replaced by arya.begin() or arya.data().
hth
Paavo