1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 #include <cassert> 11 #include <map> 12 13 int main() { 14 typedef std::pair<const int, double> V; 15 V ar[] = { 16 V(1, 1.5), V(2, 2.5), V(3, 3.5), V(4, 4.5), 17 V(5, 5.5), V(7, 7.5), V(8, 8.5), 18 }; 19 std::map<int, double> m(ar, ar + sizeof(ar) / sizeof(ar[0])); 20 m.at(1) = -1.5; 21 try { 22 m.at(6); 23 assert(0); 24 } catch (std::out_of_range &) { 25 } 26 } 27