//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template struct hash>; #include #include #include #include int main() { #if _LIBCPP_STD_VER > 11 using std::experimental::optional; { typedef int T; optional opt; assert(std::hash>{}(opt) == 0); opt = 2; assert(std::hash>{}(opt) == std::hash{}(*opt)); } { typedef std::string T; optional opt; assert(std::hash>{}(opt) == 0); opt = std::string("123"); assert(std::hash>{}(opt) == std::hash{}(*opt)); } { typedef std::unique_ptr T; optional opt; assert(std::hash>{}(opt) == 0); opt = std::unique_ptr(new int(3)); assert(std::hash>{}(opt) == std::hash{}(*opt)); } #endif // _LIBCPP_STD_VER > 11 }