如何将带有自动的语句转换为使用类型的语句

how to convert a statement with auto into one which uses types

本文关键字:语句 转换 类型      更新时间:2023-10-16

我更喜欢使用类型,但是我正在努力使类型正确,并在代码中的以下自动语句的一行中。

特别是my_struct.get_map::const_iterator.begin((这一行似乎是一个问题。

auto selected_node = std::next(my_struct.get_map.begin(), selected_item_index); // working
std::pair<std::string, std::string> selected_node = std::next(my_struct.get_map::const_iterator.begin(), selected_item_index); // not working

你知道如何声明映射的迭代器吗?用迭代器替换自动。例如,如果您的map(get_map返回(是map<字符串,字符串>则自动替换为map< string,string >::iterator it