I have a problem using templates and const.
I want to be sure that in _coefs function, h can not be changed. So I use
const but the result is that I can not use a pointer to double to pass the
array of doubles.
Any idea?
P.D: If you delete the const the code compiles ok.
Thank you in advance.
Jose Manuel Tovar
[C++ Error] Unit1.cpp(39): E2034 Cannot convert 'double *' to 'double[7]'
[C++ Error] Unit1.cpp(39): E2342 Type mismatch in parameter 'h' (wanted
'double ( &) const[7]', got 'double *')
template <class VCTH>
void _coefs (const VCTH& h)
{
}
//---------------------------------------------------------------------------
template <class VCTH>
void _trazador (VCTH& h)
{
h[0] = 2;
_coefs (h);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
double h[7];
h[0] = 1;
_trazador (h);
}
//---------------------------------------------------------------------------