index_tuple.pass.cpp (914B)
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 // UNSUPPORTED: c++98, c++03 11 12 // <unordered_map> 13 14 // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, 15 // class Alloc = allocator<pair<const Key, T>>> 16 // class unordered_map 17 18 // mapped_type& operator[](const key_type& k); 19 20 // https://bugs.llvm.org/show_bug.cgi?id=16542 21 22 #include <unordered_map> 23 #include <tuple> 24 25 using namespace std; 26 27 struct my_hash 28 { 29 size_t operator()(const tuple<int,int>&) const {return 0;} 30 }; 31 32 int main() 33 { 34 unordered_map<tuple<int,int>, size_t, my_hash> m; 35 m[make_tuple(2,3)]=7; 36 }