你好,我有一个函数需要 std::vector<T>::const_iterator
作为参数。
问题是:
如何将类型 T 的独立对象转换为迭代器,以便将其用作参数?
最佳答案
"How can I cast standalone object of type T, into iterator, so I can use it as an argument?"
你不能。该独立对象 需要存储在适当的容器中。只有容器提供迭代器的创建。
关于c++ - 将对象转换为 vector 的 const_iterator,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29950712/