index or position in std::set

前端 未结 3 1809
别那么骄傲
别那么骄傲 2020-12-09 21:28

I have a std::set of std::string. I need the \"index\" or \"position\" of each string in the set, is this a meaningful concept in the context?

I guess find() will re

3条回答
  •  感情败类
    2020-12-09 21:47

    std::distance is what you need. You will want, I guess std::distance(set.begin(), find_result)

提交回复
热议问题