stl - unexpected output from C++ multiset lower_bound -


wondeirng why below code returns 1? never insert 1 multiset container.

#include <iostream> #include <set>  int main () {   std::multiset<int> mymultiset;   std::multiset<int>::iterator itlow;    mymultiset.insert(-3);   itlow = mymultiset.lower_bound (3);   std::cout << *itlow << endl; // output 1    return 0; } 

mymultiset.lower_bound(3) returns lowest location in container 3 go, , that's @ end of container. itlow equal mymultiset.end(), , not dereferenceable. std::cout << *itlow has undefined behavior.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -