1 //===----------------------------------------------------------------------===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // <iterator> 10 11 // template<class NotAnIterator> 12 // struct iterator_traits 13 // { 14 // }; 15 16 #include <iterator> 17 18 #include "test_macros.h" 19 20 struct not_an_iterator 21 { 22 }; 23 24 template <class T> 25 struct has_value_type 26 { 27 private: 28 struct two {char lx; char lxx;}; 29 template <class U> static two test(...); 30 template <class U> static char test(typename U::value_type* = 0); 31 public: 32 static const bool value = sizeof(test<T>(0)) == 1; 33 }; 34 main(int,char **)35int main(int, char**) 36 { 37 typedef std::iterator_traits<not_an_iterator> It; 38 static_assert(!(has_value_type<It>::value), ""); 39 40 return 0; 41 } 42