|
|
So, I'm trying to initialize some arrays, of a size determined by how many
sensors are specified in a little control panel section of the code.
I [finally] wrote a working function ( ZeroArray )
//------------------------------------------------
void ZeroArray (float *Array)
{
for (int Element = 0; Element < NumSensors; Element++)
{
Array [Element] = 0;
}
}
//------------------------------------------------
and now I'm trying to initialize arrays either with floats OR bool values
//---------------------------------------------------------
template <typename T, typename N>
void InitializeArray (T *Array, N *Value)
{
for (int Element = 0; Element < NumSensors; Element++)
{
Array [Element] = Value;
}
}
//---------------------------------------------------------
Of course, I have no idea WTH I'm doing and trying to search online for a sane,
concise, and meaningful answer is difficult and time consuming.
void setup ()
{
...
line 224: InitializeArray (IntegralOutOfRange, false);
...
}
/home/oem/Arduino/Sketches/TempSensorCalibratorv0.1.0/TempSensorCalibratorv0.1.0.ino:
In function 'void setup()':
TempSensorCalibratorv0.1.0:224:44: error: no matching function for call to
'InitializeArray(bool [2], bool)'
InitializeArray (IntegralOutOfRange, false);
^
/home/oem/Arduino/Sketches/TempSensorCalibratorv0.1.0/TempSensorCalibratorv0.1.0.ino:137:6:
note: candidate: template<class T, class N> void InitializeArray(T*, N*)
void InitializeArray (T *Array, N *Value)
^~~~~~~~~~~~~~~
/home/oem/Arduino/Sketches/TempSensorCalibratorv0.1.0/TempSensorCalibratorv0.1.0.ino:137:6:
note: template argument deduction/substitution failed:
/home/oem/Arduino/Sketches/TempSensorCalibratorv0.1.0/TempSensorCalibratorv0.1.0.ino:224:44:
note: mismatched types 'N*' and 'bool'
InitializeArray (IntegralOutOfRange, false);
Any ideas?
Post a reply to this message
|
|