OpenImageIO/oiio — pull request #799 by lgritz (2014-02-05 22:41:12+00:00)
Title: array_view and friends

Some templates I've been fooling around with as a background task and finally polished last weekend:

* strided_ptr -- acts like T* but with non-default strides.
* array_view -- encapsulates ptr+length, ideal for passing 1D array parameters in a way that's safer than just a passing a pointer and hoping caller and callee agree on the length.
* array_view_strided -- like array_view, but with non-default strides
* image_view -- like array_view_strided, but for a 4D array organized like an image (depth, length, width, nchannels).

I'm not sure exactly how or where I want to use these yet, but they encapsulate idioms that we use frequently, all over the place, and which are unnecessarily verbose and error-prone to have to recode at every spot that we need to traverse strided blocks of data.

I'm making the headers public, because in addition to being useful within OIIO, I can imagine that the sorts of apps that use OIIO probably will find these templates useful for their own internals.