15a83710eSEric Fiselier //===----------------------------------------------------------------------===// 25a83710eSEric Fiselier // 357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information. 557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 65a83710eSEric Fiselier // 75a83710eSEric Fiselier //===----------------------------------------------------------------------===// 85a83710eSEric Fiselier 95a83710eSEric Fiselier // <iterator> 105a83710eSEric Fiselier 115a83710eSEric Fiselier // template<class NotAnIterator> 125a83710eSEric Fiselier // struct iterator_traits 135a83710eSEric Fiselier // { 145a83710eSEric Fiselier // }; 155a83710eSEric Fiselier 165a83710eSEric Fiselier #include <iterator> 175a83710eSEric Fiselier 18*7fc6a556SMarshall Clow #include "test_macros.h" 19*7fc6a556SMarshall Clow 205a83710eSEric Fiselier struct not_an_iterator 215a83710eSEric Fiselier { 225a83710eSEric Fiselier }; 235a83710eSEric Fiselier 24aae63566SStephan T. Lavavej template <class T> 255a83710eSEric Fiselier struct has_value_type 265a83710eSEric Fiselier { 275a83710eSEric Fiselier private: 285a83710eSEric Fiselier struct two {char lx; char lxx;}; 29709be5eeSStephan T. Lavavej template <class U> static two test(...); 30709be5eeSStephan T. Lavavej template <class U> static char test(typename U::value_type* = 0); 315a83710eSEric Fiselier public: 32aae63566SStephan T. Lavavej static const bool value = sizeof(test<T>(0)) == 1; 335a83710eSEric Fiselier }; 345a83710eSEric Fiselier main(int,char **)352df59c50SJF Bastienint main(int, char**) 365a83710eSEric Fiselier { 375a83710eSEric Fiselier typedef std::iterator_traits<not_an_iterator> It; 385a83710eSEric Fiselier static_assert(!(has_value_type<It>::value), ""); 392df59c50SJF Bastien 402df59c50SJF Bastien return 0; 415a83710eSEric Fiselier } 42