我有用C++编写的这个循环,用MSVC2010编译需要很长时间才能运行.(300毫秒)
for (int i=0; i<h; i++) {
for (int j=0; j<w; j++) {
if (buf[i*w+j] > 0) {
const int sy = max(0, i - hr);
const int ey = min(h, i + hr + 1);
const int sx = max(0, j - hr);
const int ex = min(w, j + hr + 1);
float val = 0;
for (int k=sy; k < ey; k++) {
for (int m=sx; m < ex; m++) {
val += original[k*w + m] * …Run Code Online (Sandbox Code Playgroud) auto a = (Foo<T>*)malloc(sizeof(Foo<T>));
auto *b = (Foo<T>*)malloc(sizeof(Foo<T>));
Run Code Online (Sandbox Code Playgroud)
我不认为模板是存在的,但问题是它的重要的:是a和b相同类型的?
g++ -std=c++0x -Wall (4.4)没有给出任何错误或警告,但我没有运行程序,所以我不知道它是否做同样的事情.
这是否意味着a,auto是Foo<T>*,但是b,auto是Foo<T>吗?