typedef TriIndex ...
typedef std::map< TriIndex, unsigned int > VertexMap;
VertexMap vertex_map;
for ( size_t i = 0; i < face.size(); ++i ) {
for ( size_t j = 0; j < 3; ++j ) {
std::pair< VertexMap::iterator, bool > rv = vertex_map.insert( std::make_pair( face.v[j], vert_idx_counter ) );
if ( rv.second ) {
//do stuff
}
}
}
I took out a snippet from an opengl starter code. I get what it's doing except for the following line:
std::pair< VertexMap::iterator, bool > rv = vertex_map.insert( std::make_pair( face.v[j], vert_idx_counter ) );
I get that the line declares a pair called rv with an iterator and a boolean value - . But on the right hand side, there is vertex_map.insert - but from what i know, insert is a void function. How do you get a pair from inserting a pair to vertex map?
vertex_map与'std :: map <TriIndex,unsigned int>'相同,因此您正在调用地图的插入函数,有关更多详细信息,请参阅文档std :: map :: insert
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.