Revert "[libc] Use best-fit binary trie to make malloc logarithmic" (#117065)
[llvm-project.git] / libcxx / test / std / iterators / iterator.primitives / iterator.traits / const_pointer.pass.cpp
blobeef05b6a0273e1948ec2f92bbe624354c94afddc
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 T>
12 // struct iterator_traits<const T*>
13 // {
14 // typedef ptrdiff_t difference_type;
15 // typedef T value_type;
16 // typedef const T* pointer;
17 // typedef const T& reference;
18 // typedef random_access_iterator_tag iterator_category;
19 // };
21 #include <iterator>
22 #include <cstddef>
23 #include <type_traits>
25 #include "test_macros.h"
27 struct A {};
29 int main(int, char**)
31 typedef std::iterator_traits<const A*> It;
32 static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), "");
33 static_assert((std::is_same<It::value_type, A>::value), "");
34 static_assert((std::is_same<It::pointer, const A*>::value), "");
35 static_assert((std::is_same<It::reference, const A&>::value), "");
36 static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), "");
38 #if TEST_STD_VER > 17
39 ASSERT_SAME_TYPE(It::iterator_concept, std::contiguous_iterator_tag);
40 #endif
42 return 0;