I'm writing an application for Arduino (more precisely, Teensy). While compiling the following code (last pasted line):
void executeActions(std::shared_ptr<unsigned char[]> actionData, const unsigned short actionBytes)
{
unsigned short modifier = 0;
Keyboard.set_modifier(modifier);
int i = 0;
while (i < actionBytes)
{
unsigned char action = actionData[i];
I'm getting the following error:
no match for 'operator[]' (operand types are 'std::shared_ptr<unsigned char []>' and 'int')
For reference, mentioned actionData
is initialized in the following way (then passed a couple of times):
this->actionData = std::make_shared<unsigned char[]>(new unsigned char[this->actionBytes]);
What am I doing wrong?