我有未定义类型的迭代器:
for (typename Type::const_iterator hayStackIterator = hayHeap.begin(); hayStackIterator != hayHeap.end(); ++hayStackIterator) {
//some inner logic
}
并且很高兴知道我*hayStackIterator
能够根据这些信息修改内部逻辑的类型是什么......是否有一些简单的功能可以制作这样的东西?
if (*hayStackIterator.isInstanceOf(vector<string>){
//do something
} else if (*hayStackIterator.isInstanceOf(string){
//do something else
}
我可以使用这些includes
:
#include <cctype>
#include <iostream>
#include <iomanip>
#include <set>
#include <list>
#include <map>
#include <vector>
#include <queue>
#include <string>