【发布时间】:2021-12-31 04:02:56
【问题描述】:
当我使用警告标志运行以下命令时,我会收到类型转换警告。
#include <boost/multi_array.hpp>
void function (boost::multi_array<unsigned char, 2> matrix) {
int nrows = matrix.shape()[0];
int ncols = matrix.shape()[1];
}
请参阅下面的警告消息。这是否意味着我正在将“long unsigned int”隐式转换为常规“int”?
如果是这样,我认为这就是我想要的(之后需要使用 nrows、ncols 执行计算),那么我该如何明确转换?
image.cpp:93:32: warning: conversion to ‘int’ from ‘boost::const_multi_array_ref<float, 2ul, float*>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
int nrows = matrix.shape()[0];
【问题讨论】: