Changeset f31ea60 in mainline
- Timestamp:
- 2018-07-05T21:41:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 032565d
- Parents:
- 08c1df0
- git-author:
- Dzejrou <dzejrou@…> (2018-05-16 17:21:14)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:24)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/cpp/src/internal/test/memory.cpp
r08c1df0 rf31ea60 70 70 struct dummy_allocator2 71 71 { 72 using value_type = int; 73 using pointer = char*; 74 using const_pointer = const void*; 72 using value_type = int; 73 using pointer = char*; 74 using const_pointer = const void*; 75 using void_pointer = bool*; 76 using const_void_pointer = volatile bool*; 77 using difference_type = short; 78 using size_type = long; 79 80 using propagate_on_container_copy_assignment = std::true_type; 81 using propagate_on_container_move_assignment = std::true_type; 82 using propagate_on_container_swap = std::true_type; 83 using is_always_equal = std::true_type; 75 84 }; 76 85 } … … 198 207 using dummy_traits2 = std::allocator_traits<aux::dummy_allocator2>; 199 208 200 /* static_assert(std::is_same_v<typename dummy_traits1::pointer, int*>); */ 201 /* static_assert(std::is_same_v<typename dummy_traits2::pointer, char*>); */ 209 /** 210 * First dummy allocator doesn't provide 211 * anything except for the mandatory value_type, 212 * so we get all the defaults here. 213 */ 214 static_assert(std::is_same_v<typename dummy_traits1::pointer, int*>); 215 static_assert(std::is_same_v<typename dummy_traits1::const_pointer, const int*>); 216 static_assert(std::is_same_v<typename dummy_traits1::void_pointer, void*>); 217 static_assert(std::is_same_v<typename dummy_traits1::const_void_pointer, const void*>); 218 static_assert(std::is_same_v<typename dummy_traits1::difference_type, ptrdiff_t>); 219 static_assert(std::is_same_v<typename dummy_traits1::size_type, std::make_unsigned_t<ptrdiff_t>>); 220 static_assert(std::is_same_v<typename dummy_traits1::propagate_on_container_copy_assignment, std::false_type>); 221 static_assert(std::is_same_v<typename dummy_traits1::propagate_on_container_move_assignment, std::false_type>); 222 static_assert(std::is_same_v<typename dummy_traits1::propagate_on_container_swap, std::false_type>); 223 static_assert(std::is_same_v<typename dummy_traits1::is_always_equal, typename std::is_empty<aux::dummy_allocator1>::type>); 224 225 /** 226 * Second dummy allocator provides all typedefs, so 227 * the the traits just use identity. 228 */ 229 static_assert(std::is_same_v<typename dummy_traits2::pointer, char*>); 230 static_assert(std::is_same_v<typename dummy_traits2::const_pointer, const void*>); 231 static_assert(std::is_same_v<typename dummy_traits2::void_pointer, bool*>); 232 static_assert(std::is_same_v<typename dummy_traits2::const_void_pointer, volatile bool*>); 233 static_assert(std::is_same_v<typename dummy_traits2::difference_type, short>); 234 static_assert(std::is_same_v<typename dummy_traits2::size_type, long>); 235 static_assert(std::is_same_v<typename dummy_traits2::propagate_on_container_copy_assignment, std::true_type>); 236 static_assert(std::is_same_v<typename dummy_traits2::propagate_on_container_move_assignment, std::true_type>); 237 static_assert(std::is_same_v<typename dummy_traits2::propagate_on_container_swap, std::true_type>); 238 static_assert(std::is_same_v<typename dummy_traits2::is_always_equal, std::true_type>); 202 239 } 203 240 … … 215 252 int x{10}; 216 253 test_eq("pointer_traits<Ptr>::pointer_to", dummy_traits1::pointer_to(x).tag, 10); 254 test_eq("pointer_traits<T*>::pointer_to", int_traits::pointer_to(x), &x); 217 255 218 256 static_assert(std::is_same_v<typename dummy_traits2::pointer, aux::dummy_pointer2<int, char>>);
Note:
See TracChangeset
for help on using the changeset viewer.