Is is possible to make getFirst10() to work? It seems impossible to cast the uint256[100] memory to uint256[10] memory.
contract Test {
uint256[100] private foo;
function get() external view returns (uint256[100] memory) {
return foo; // Works
}
function getFirst10() external view returns (uint256[10] memory) {
return uint256[10](foo); // Doesn't compile
}
}
The closest I've gotten is is the try above, but it fails with the error: Error: Explicit type conversion not allowed from "uint256[100] storage ref" to "uint256[10] storage pointer"
What I'm trying to do is have a function that returns a sub-slice of a large uint256[] storage array.. is there any way to do that? Do I have to return calldata instead and copy each element?