类模板对象是怎么使用类中重载的()输出的

2025-02-24 14:42:20
推荐回答(1个)
回答1:

for_each是个模板函数啊,内部无非就是循环一遍,每个元素都调用一次pr1().

template
    _Funct for_each(_IIter start, _IIter end, _Funct fun)
    { 
        foreach(auto it = start; it != end; ++it)
            fun(*it);
       
        return fun;
    }