ตอนที่ฉันวิ่งต่อไปนี้กับคำเตือนธงฉันให้เป็นประเภทการแปลงเตือน
#include <boost/multi_array.hpp>
void function (boost::multi_array<unsigned char, 2> matrix) {
int nrows = matrix.shape()[0];
int ncols = matrix.shape()[1];
}
เห็นข้อความแจ้งเตือนทางด้านล่างนี้ นี่หมายความว่าฉันเป็น implicitly เปลี่ยนมานานโดยไม่เซ็น int ได้เข้าเป็นปกติ'int'?
ถ้าอย่างนั้นฉันคิดว่านี่คือสิ่งที่ฉันต้องการ(ต้องแสดงคำนวณกับ nrows,ncols หลังจากนั้น)แล้วทำไมฉันจะต้องทำการแปลง explicit?
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];