typedef boost::shared_ptr<config_value_c> config_value_ptr;
typedef std::vector<config_value_ptr> config_value_vec;
config_value_vec config;
typeof (config.iterator()) it = config.iterator();
클래스 config_value_c에 대한 부스트 포인터 배열에 반복기를 추출하려고합니다. 나는 반복자를 std :: vector로 지정할 수 있다는 것을 안다. <config_value_ptr> :: iterator하지만 이것을 유형에 구애받지 않는 방식으로하고 싶다. 따라서 벡터를 목록으로 변경하면 다시 돌아갈 필요가 없다. 코드. 그게 가능하니? 감사.이 코드를 작성하는 올바른 방법은 무엇입니까?
저는 typeof가 실제 키워드가 아니며 typeid를 알고 있지만 원하는 것을하지 않습니다.
이config_value_vec::iterator it = config.begin();
허용 할 C++ 표준 (C + +0)의 다음 에디션은 당신이해야 할 :
auto it = config.begin();
'config_value_vec :: iterator'의 문제점은 무엇입니까? – avakar