Tweak array_from_ptr to accept more type inputs