G
Gary Wessle
Hi
can I use
if( set.count(key) ) // element exists
{
// do something.
}
else if( !set.count(key) ) // it does not exist
{
// so something else.
}
http://www.cppreference.com/cppset/count.html
count() returns the number of occurrences of key in the set.
size_type count( const key_type& key );
well, if set is like a map with values are them selves the keys, and
the map holds unique keys, then count will always return 1 if the key
exist and 0 if it does not.
what am I missing?
thanks
can I use
if( set.count(key) ) // element exists
{
// do something.
}
else if( !set.count(key) ) // it does not exist
{
// so something else.
}
http://www.cppreference.com/cppset/count.html
count() returns the number of occurrences of key in the set.
size_type count( const key_type& key );
well, if set is like a map with values are them selves the keys, and
the map holds unique keys, then count will always return 1 if the key
exist and 0 if it does not.
what am I missing?
thanks