I am writing a template function that checks if item is present in the given arr. However, as I am writing the function declaration in my hpp file, this weird compile error happens.
In my hpp file, I wrote:
template <typename T>
bool includes(const T[]& arr, const T& item);
This is the compilation error I got:
includes/functions.hpp:20:24: error: expected ')'
bool includes(const T[]& arr, const T& item);
^
includes/functions.hpp:20:14: note: to match this '('
bool includes(const T[]& arr, const T& item);
^
1 error generated.
In file included from src/functions.cc:1:
includes/functions.hpp:20:24: error: expected ')'
bool includes(const T[]& arr, const T& item);
^
includes/functions.hpp:20:14: note: to match this '('
bool includes(const T[]& arr, const T& item);
^
1 error generated.
make: *** [Makefile:8: bin/exec] Error 1
The compilation options I used are clang++ -std=c++20 -Iincludes -g -fstandalone-debug -O0 -Wall -Wextra -Werror. The OS is a Linux VM ran on Vagrant. Why is this error?