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 // <algorithm> 11 12 // template<LessThanComparable T> 13 // const T& 14 // min(const T& a, const T& b); 15 16 #include <algorithm> 17 #include <cassert> 18 19 template <class T> 20 void 21 test(const T& a, const T& b, const T& x) 22 { 23 assert(&std::min(a, b) == &x); 24 } 25 26 int main() 27 { 28 { 29 int x = 0; 30 int y = 0; 31 test(x, y, x); 32 test(y, x, y); 33 } 34 { 35 int x = 0; 36 int y = 1; 37 test(x, y, x); 38 test(y, x, x); 39 } 40 { 41 int x = 1; 42 int y = 0; 43 test(x, y, y); 44 test(y, x, y); 45 } 46 } 47