显然,搜索引擎似乎没有采用此符号'<> '搜索,因此有人可以向我解释这个符号的含义以及声明吗?
对于声明,我猜是
p = I.ptr<uchar>(i);
p碰巧指向I [i]地址。
谢谢:)
答案 0 :(得分:0)
它使用i
参数调用类的成员函数。例如
#include <iostream>
using std::cout;
using std::endl;
class Something {
public:
template <typename T>
T do_something(T in) {
cout << __PRETTY_FUNCTION__ << endl;
return in;
}
};
int main() {
auto something = Something{};
// <int> not really needed here, the type can be deduced,
// just here for demonstration purposes
auto integer = something.do_something<int>(1);
(void) integer;
}
请注意,为了在模板类型的上下文中执行此操作,您需要使用template
为方法调用添加前缀,如此问题中所述 - Where and why do I have to put the "template" and "typename" keywords?