const_volatile_pointer.pass.cpp (967B)
1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <iterator> 11 12 // template<class T> 13 // struct iterator_traits<const T*> 14 15 #include <iterator> 16 #include <type_traits> 17 18 struct A {}; 19 20 int main() 21 { 22 typedef std::iterator_traits<const volatile A*> It; 23 static_assert((std::is_same<It::difference_type, std::ptrdiff_t>::value), ""); 24 static_assert((std::is_same<It::value_type, A>::value), ""); 25 static_assert((std::is_same<It::pointer, const volatile A*>::value), ""); 26 static_assert((std::is_same<It::reference, const volatile A&>::value), ""); 27 static_assert((std::is_same<It::iterator_category, std::random_access_iterator_tag>::value), ""); 28 }