How can I call templatized operator () ()?

I have a structure that looks something like this:

struct foo_t
{
    template <std::size_t x, std::size_t y>
    std::size_t operator()() const
    { return /*something dealing with x and y*/; }
};

The definition seems to compile fine, but what should I call it? I can't seem to get anything from the compiler:

foo_t foo;
foo<3, 3>(); // ERROR: Compiler seems to think I'm asking for "foo < 3 ..."
+1
source share
1 answer

It's ugly, but ..,

foo_t foo;
foo.operator()<3, 3>();

online demo

+6
source

All Articles