#include “stdafx.h”
#include <map>
#include <limits>
template<typename K, typename V>
class interval_map {
std::map<K, V> m_map;
public:
// constructor associates whole range of K with val by inserting(K_min, val)
// into the map
interval_map(V const& val) {
m_map.insert(m_map.end(),std::make_pair(std::numeric_limits<K>::lowest(), val));
}
// Assign value val to interval [keyBegin, keyEnd).
// Overwrite previous values in this interval.
// Conforming to the C++ Standard Library conventions, theinterval
// includes keyBegin, but excludes keyEnd.
// If !( keyBegin < keyEnd ), this designates an emptyinterval,
// and assign must do nothing.
void assign(K const& keyBegin, K const& keyEnd, Vconst& val) {
// INSERT YOUR SOLUTION HERE
}
// look-up of the value associated with key
V const& operator[](K const& key) const {
return (–m_map.upper_bound(key))->second;
}
};
I have this C++
PayPal Gateway not configured
PayPal Gateway not configured