MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / resize

Method resize

source/core/StarMultiArray.hpp:192–208  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190
191template <typename Element, size_t Rank>
192void MultiArray<Element, Rank>::resize(SizeArray const& shape) {
193 if (m_data.empty()) {
194 setSize(shape);
195 return;
196 }
197
198 bool equal = true;
199 for (size_t i = 0; i < Rank; ++i)
200 equal = equal && (m_shape[i] == shape[i]);
201
202 if (equal)
203 return;
204
205 MultiArray newArray(shape);
206 newArray.copy(*this);
207 std::swap(*this, newArray);
208}
209
210template <typename Element, size_t Rank>
211void MultiArray<Element, Rank>::resize(SizeArray const& shape, Element const& c) {

Callers 1

setSizeMethod · 0.45

Calls 2

emptyMethod · 0.45
copyMethod · 0.45

Tested by

no test coverage detected