/* * (C) Copyright 2013 ECMWF. * * This software is licensed under the terms of the Apache Licence Version 2.0 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. * In applying this licence, ECMWF does not waive the privileges and immunities * granted to it by virtue of its status as an intergovernmental organisation * nor does it submit to any jurisdiction. */ #pragma once #include #include #include #include "atlas/library/config.h" //------------------------------------------------------------------------------------------------------ namespace atlas { namespace array { //using ArrayIdx = std::vector; typedef std::vector ArrayIdx; namespace detail { inline ArrayIdx make_idx(idx_t size1) { return std::vector(1, size1); } inline ArrayIdx make_idx(idx_t size1, idx_t size2) { std::vector v(2); v[0] = size1; v[1] = size2; return v; } inline ArrayIdx make_idx(idx_t size1, idx_t size2, idx_t size3) { std::vector v(3); v[0] = size1; v[1] = size2; v[2] = size3; return v; } inline ArrayIdx make_idx(idx_t size1, idx_t size2, idx_t size3, idx_t size4) { std::vector v(4); v[0] = size1; v[1] = size2; v[2] = size3; v[3] = size4; return v; } } // namespace detail template ArrayIdx make_idx(idx_t... indices) { return detail::make_idx(std::forward(indices)...); } //------------------------------------------------------------------------------------------------------ } // namespace array } // namespace atlas