templates - C++ Visual Studio 2013 Strange error but code runs -
i trying use __declspec properties , getting strange errors when using multiple indicies. error: "expression must pointer complete object type" in visual studio, code seems run fine. here code using:
#include "stdafx.h" template<typename t> class testclass { public: __declspec (property (get = getvalue, put = putvalue)) t test[][]; t getvalue(int x, int y) { return _internalval[x][y]; } void putvalue(int x, int y, t lvalue) { _internalval[x][y] = lvalue; } private: t _internalval[3][3]; }; int _tmain(int argc, _tchar* argv[]) { testclass<int> tc; (int = 0; < 3; i++){ (int j = 0; j < 3; j++){ tc.test[i][j] = * j; } } return 0; }
this example using __declspec property on template class using multidimensional property. if remove 1 set of brackets , parameters, seems error goes away , code runs expected. code now, throws error in visual studio , still runs.
why concern? work in team , others not pleased if errors appear, , assume code wont work, although will. there way suppress such errors? why happening?
Comments
Post a Comment