I have a class template
template <typename T>
struct Foo
{
T value;
// methods
// ...
}
For the case where T
is a std::array
, I want to be able to call std::array::at
on an instance of Foo
directly.
For example I want to be able to do
Foo<std::array<int, 5>> bar;
// ...
int x = bar.at(0);
However, currently I have to use bar.value.at(0)
.
Is it possible to define the function Foo::at
only for the case where T
is a std::array
, which simply returns value.at()
? I don't know how this is done since std::array itself has template arguments. Ideally I don't want to rewrite the entire template for the specialized case.
Thanks in advance.