为什么这样做:
std::pair<int, int> p = {1,2};
std::vector<std::pair<int, int>> vp = { {1,2}, {3,4} };
Run Code Online (Sandbox Code Playgroud)
但这不是吗?
std::array<int, 2> a = {1,2}; // still ok
std::vector<std::array<int, 2>> va = { {1,2}, {3,4} };
Run Code Online (Sandbox Code Playgroud)
使用g ++ 4.5.1 -std=c++0x,第二行失败:
错误:无法转换
‘{{1, 2}, {3, 4}}’为‘std::vector<std::array<int, 2u> >’
谢谢
我需要以某种方式在磁盘上存储512 ^ 3阵列,我目前正在使用HDF5.由于阵列稀疏,因此浪费了大量磁盘空间.
HDF5是否为稀疏阵列提供任何支持?
有以下代码段错误的明显原因吗?
#include <vector>
#include <emmintrin.h>
struct point {
__m128i v;
point() {
v = _mm_setr_epi32(0, 0, 0, 0);
}
};
int main(int argc, char *argv[])
{
std::vector<point> a(3);
}
Run Code Online (Sandbox Code Playgroud)
谢谢
编辑:我在linux/i686上使用g ++ 4.5.0,我可能不知道我在做什么,但是因为甚至以下的段错误
int main(int argc, char *argv[])
{
point *p = new point();
}
Run Code Online (Sandbox Code Playgroud)
我真的认为它必须和对齐问题.