/* * (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 //------------------------------------------------------------------------------------------------------ namespace atlas { namespace array { class ArrayLayout : public std::vector { private: using Base = std::vector; public: ArrayLayout() {} ArrayLayout(std::initializer_list list): Base(list) {} ArrayLayout(Base&& base): Base(std::forward(base)) {} }; namespace detail { inline ArrayLayout make_layout(idx_t size1) { return ArrayLayout{size1}; } inline ArrayLayout make_layout(idx_t size1, idx_t size2) { return ArrayLayout{size1, size2}; } inline ArrayLayout make_layout(idx_t size1, idx_t size2, idx_t size3) { return ArrayLayout{size1, size2, size3}; } inline ArrayLayout make_layout(idx_t size1, idx_t size2, idx_t size3, idx_t size4) { return ArrayLayout{size1, size2, size3, size4}; } inline ArrayLayout make_layout(idx_t size1, idx_t size2, idx_t size3, idx_t size4, idx_t size5) { return ArrayLayout{size1, size2, size3, size4, size5}; } } // namespace detail template ArrayLayout make_layout(idx_t... indices) { return detail::make_layout(std::forward(indices)...); } //------------------------------------------------------------------------------------------------------ } // namespace array } // namespace atlas