fbr*_*eto 1 c++ templates compiler-errors operators
我有一个看起来像这样的结构:
struct foo_t
{
template <std::size_t x, std::size_t y>
std::size_t operator()() const
{ return /*something dealing with x and y*/; }
};
Run Code Online (Sandbox Code Playgroud)
该定义似乎编译得很好,但我怎么称呼它?我似乎无法通过编译器得到任何东西:
foo_t foo;
foo<3, 3>(); // ERROR: Compiler seems to think I'm asking for "foo < 3 ..."
Run Code Online (Sandbox Code Playgroud)
这很难看,但......
foo_t foo;
foo.operator()<3, 3>();
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
142 次 |
最近记录: |