Add function array_cast<T>
Simplify template. These complicated templates cannot be compiled with VS2012