我正在尝试构建的脚本中有以下代码。
typedef std::vector< typename Sphere::vec_type > VV;
typedef typename Sphere::vec_type vec_type;
VV v( count , s.dimension() );
for ( int ii=0; ii<count; ++ii ) {
v[ii] = randomPointOnSurface( s );
它会产生此错误:
error: no matching function for call to 'std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >::_M_fill_initialize(size_t, int&)'
/usr/include/c++/4.4/bits/stl_vector.h:1033: note: candidates are: void std::vector<_Tp, _Alloc>::_M_fill_initialize(size_t, const _Tp&) [with _Tp = std::vector<float, std::allocator<float> >, _Alloc = std::allocator<std::vector<float, std::allocator<float> > >]
一种解决方法是删除 s.dimension() 但有没有其他方法可以解决这个问题?