Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / iterators / iterator.primitives / iterator.traits / iterator.pass.cpp
blobfc9d5d679b9253ccc9e61a230881db9fcef3c324
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 //===----------------------------------------------------------------------===//
9 // <iterator>
11 // template<class Iter>
12 // struct iterator_traits
13 // {
14 // typedef typename Iter::difference_type difference_type;
15 // typedef typename Iter::value_type value_type;
16 // typedef typename Iter::pointer pointer;
17 // typedef typename Iter::reference reference;
18 // typedef typename Iter::iterator_category iterator_category;
19 // };
21 #include <iterator>
22 #include <type_traits>
24 #include "test_macros.h"
26 struct A {};
28 struct test_iterator
30 typedef int difference_type;
31 typedef A value_type;
32 typedef A* pointer;
33 typedef A& reference;
34 typedef std::forward_iterator_tag iterator_category;
37 int main(int, char**)
39 typedef std::iterator_traits<test_iterator> It;
40 static_assert((std::is_same<It::difference_type, int>::value), "");
41 static_assert((std::is_same<It::value_type, A>::value), "");
42 static_assert((std::is_same<It::pointer, A*>::value), "");
43 static_assert((std::is_same<It::reference, A&>::value), "");
44 static_assert((std::is_same<It::iterator_category, std::forward_iterator_tag>::value), "");
46 return 0;