容器适配器不支持迭代器 [英] Container Adapters do not support iterators

查看:43
本文介绍了容器适配器不支持迭代器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一篇关于 STL 的 C++ 文章中,是这样说的 -

In one of the C++ articles on STL, is being said that -

由于容器适配器不支持迭代器,因此它们不能与 STL 算法一起使用.

Since container adapters do not support iterators, hence they cannot be used with the STL algorithms.

但是它没有解释为什么容器适配器不支持迭代器?有人能解释一下吗?

But it did not explain as to why Container Adapters do not support iterators? Can anybody explain me the same?

推荐答案

具有迭代器的堆栈或队列有什么意义?根据定义,堆栈是只能推入和弹出的东西……迭代器会破坏这些适配器的全部目的

What's the point of a stack or a queue having an iterator? A stack is by definition something that you can only push and pop into... An iterator would destroy the whole purpose of these adapters

这篇关于容器适配器不支持迭代器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆