I'm trying to pass a reference to a fixed-sized C-style array to a constructor. Here is my code:
#include <cstddef>
template <typename T, size_t size>
class Foo
{
public:
Foo(T (&arr)[size]);
T (&m_arr)[size];
size_t m_size;
};
Foo::Foo(T (&arr)[size])
: m_arr {arr},
m_size {size}
{}
Here are the build errors when trying to compile the above:
invalid use of template-name 'Foo' without an argument list
expected unqualified-id before ',' token
expected constructor, destructor, or type conversion before '{' token
expected unqualified-id before '{' token
Using the STL is not an option.
I'm using GNU v7.3.1 (Linaro).