// c++ has no builtin function to find the greater key LESS THAN the supplied key. The solution I've found is to get an iterator to the key with find() and traverse back with std::prev
constauto&tmp=treemap.lower_bound(end);
constauto&end_prev_entry=tmp!=treemap.begin()&&tmp!=treemap.end()?std::prev(tmp):tmp;// first element before end
constauto&end_next_entry=treemap.upper_bound(end);// first element after end
constauto&tmp1=treemap.lower_bound(start);
constauto&start_entry=tmp1!=treemap.begin()&&tmp1!=treemap.end()?std::prev(tmp1):tmp1;// first element before start
Vv{};
// insert the start key. Replaces whatever value is already there. Do not place if the element before is of the same value