def gen_elem_array(size, elem_type=None):
if elem_type is None or not callable(elem_type):<EOL><INDENT>return [elem_type] * size<EOL><DEDENT>if is_type(elem_type, ContainerType):<EOL><INDENT>def elem_type():<EOL><INDENT>return []<EOL><DEDENT><DEDENT>res = []<EOL>for _ in range(size):<EOL><INDENT>res.append(elem_type())<EOL><DEDENT>return res<EOL>
Generates element array of given size and initializes with given type.
Supports container type, used for pre-allocation before deserialization.
:param size:
:param elem_type:
:return: