是否可以确定传递的迭代器是否属于关联的 std 容器?
Is it possible to determine if a passed iterator belongs to a associative std container?
我想从传递给函数的迭代器中确定 std 容器类型(至少是关联或线性(。
我已经搜索了适当的迭代器特征和类型特征,但没有成功。
template <typename RangeIter, typename InputIter>
inline bool filter(RangeIter in_data, InputIter result)
{
...
/* determine the container types here - but how?!? */
std::copy_if(in_data.first, in_data.second, result, /* some predicate code here*/);
...
}
No.(好吧,对于StackOverflow来说可能有点太短了(。
无法确定迭代器引用的"容器",因为它们根本不需要引用容器。
例:
int foo, bar;
std::copy(&foo, &foo+1, &bar);
在此示例中,传递给std::copy
的迭代器都没有引用"容器"。
相关文章:
- 如何确定2个URI(路径)是否属于同一分区或卷
- 是否可以确定传递的迭代器是否属于关联的 std 容器?
- 如何使用C或C 查找给定的IPv6地址是否属于CIDR范围
- 如何找出内存是否属于堆或堆栈
- 检查两种类型是否属于同一模板
- 检查第 n 个可变参数模板参数是否属于特定类型
- Boost检查该类型是否属于给定类型的列表
- 如何使用Qt确定我的互联网IP是否属于给定的IP列表
- 是否有任何不属于C++标准库的 STL 标头
- 模板专业化是否属于头文件或源文件
- 检查字符串是否属于具有字符串向量作为值的映射的值
- 验证基对象是否属于特定的派生类型
- 使用inet_pton()检查给定的IP是否属于IP范围
- 当向第三方提供库时,C++include文件是否属于安全漏洞
- 我如何询问一个对象是否属于类x
- "位字段类型对于位数来说太小"错误是否属于C++标准?
- 从字符串字面值初始化字符数组是否属于数组复制初始化的情况?
- 测试类型 V 是否属于没有变变量的元组类型<...>
- 有什么方法可以检测QObject是否属于"dead" QThread?
- 在c++中测试数据是否属于某种数据类型