是否可以根据基于的范围类型调用不同的取消引用运算符重载
Is it possible to invoke different overloads of dereference operator depending on the type of range-based for
我很确定这是不可能的,但只是为了确定一下——是否可以根据基于范围的中使用的类型,在集合的迭代器上调用不同的一元运算符*"重载"(?)。我特别感兴趣的是调用两个不同的重载:
for (auto &e: collection)
和
for (auto e: collection)
但对于给定类型的CCD_ 1,这个问题可以更为广义。
我不知道这是可能的。
但是,通过迭代不同的代理对象,您可以获得类似的行为:
for (auto &&e: collection.method1())
// ...
for (auto &&e: collection.method2())
method1
和method2
返回的代理对象实现了返回不同类型迭代器的begin
和end
函数,实现operator*
的方式不同。
相关文章:
- GLEW/GLUT:调用init并创建一个窗口后,取消初始化并重新初始化?
- C++当您取消引用指向类对象的指针,然后将其作为引用返回时,是否可以对此引用调用方法
- 取消API使用的调用
- 当按下QDialog取消或确定时如何调用函数?
- 现代编译器是否可以在使用依赖关系注入时取消虚拟化函数调用
- 使用 P/调用传递取消标志时是否需要同步
- 干净取消在输入/输出调用中被阻止的 std::线程
- 复制文件时如何调用取消?(使用复制文件 ex 函数和复制进度例程回调函数)
- 为什么INVOKE总是取消引用数据成员,而不是在可能的情况下调用
- 在取消引用的对象指针上调用成员函数
- 通过函数指针调用函数 - 是否取消引用指针?有什么区别?
- 当任务所有者被销毁时,取消挂起的任务回调调用
- 是否可以根据基于的范围类型调用不同的取消引用运算符重载
- C++ Time 或取消后调用函数
- 取消对用户输入C++的调用
- 在什么条件下调用常量取消引用运算符
- 从const_cast取消引用指针是否总是调用未定义的行为
- boost::asio::tcp::socket 关闭并取消而不调用处理程序
- 为什么在C++中调用运算符()之前要取消引用指针
- Java用JNI调用C++:为什么JNIEnv指针被取消引用两次