2

Is it possible to specialize a function for a specific array type?

For example having a template function:

template <typename T, size_t size>
void process(T (&arr)[size])
{
    // do smth
}

Could a function specialization for T=uint8_t be done in such case? Or is the only reasonable solution here to use an overload like the one below?

template <size_t size>
void process(uint8_t (&arr)[size])
{
    // do smth else
}

Thanks for suggestions and comments.

Dusteh
  • 1,496
  • 16
  • 21

1 Answers1

3

It is not possible to specialize function templates partially, so you will probably have to use a separate overload.

Kerrek SB
  • 464,522
  • 92
  • 875
  • 1,084