static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
{
typedef int* T;
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
static_assert((std::is_same<C::reverse_iterator, std::reverse_iterator<C::iterator> >::value), "");
static_assert((std::is_same<C::const_reverse_iterator, std::reverse_iterator<C::const_iterator> >::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
}
static_assert((std::is_same<
typename C::const_reverse_iterator,
std::reverse_iterator<typename C::const_iterator> >::value), "");
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
int main()
test<Copyable, test_allocator<Copyable> >();
static_assert((std::is_same<std::deque<char>::allocator_type,
std::allocator<char> >::value), "");
+
#if __cplusplus >= 201103L
{
typedef std::deque<short, min_allocator<short>> C;
// min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#endif
}
static_assert((std::is_same<C::const_pointer, const char*>::value), "");
static_assert((std::is_same<C::size_type, std::size_t>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#if __cplusplus >= 201103L
{
// min_allocator doesn't have a size_type, so one gets synthesized
static_assert((std::is_same<C::size_type, std::make_unsigned<C::difference_type>::type>::value), "");
static_assert((std::is_same<C::difference_type, std::ptrdiff_t>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
}
#endif
}
int main()
{
- static_assert((std::is_same<std::list<int>::value_type, int>::value), "");
- static_assert((std::is_same<std::list<int>::allocator_type, std::allocator<int> >::value), "");
- static_assert((std::is_same<std::list<int>::reference, std::allocator<int>::reference>::value), "");
- static_assert((std::is_same<std::list<int>::const_reference, std::allocator<int>::const_reference>::value), "");
- static_assert((std::is_same<std::list<int>::pointer, std::allocator<int>::pointer>::value), "");
- static_assert((std::is_same<std::list<int>::const_pointer, std::allocator<int>::const_pointer>::value), "");
+ {
+ typedef std::list<int> C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, std::allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, std::allocator<int>::reference>::value), "");
+ static_assert((std::is_same<C::const_reference, std::allocator<int>::const_reference>::value), "");
+ static_assert((std::is_same<C::pointer, std::allocator<int>::pointer>::value), "");
+ static_assert((std::is_same<C::const_pointer, std::allocator<int>::const_pointer>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
+
#if __cplusplus >= 201103L
- static_assert((std::is_same<std::list<int, min_allocator<int>>::value_type, int>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::reference, int&>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::const_reference, const int&>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
- static_assert((std::is_same<std::list<int, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ {
+ typedef std::list<int, min_allocator<int>> C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, int&>::value), "");
+ static_assert((std::is_same<C::const_reference, const int&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
#endif
}
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
static_assert((std::is_same<typename C::size_type, typename std::allocator_traits<Allocator>::size_type>::value), "");
static_assert((std::is_same<typename C::difference_type, typename std::allocator_traits<Allocator>::difference_type>::value), "");
- static_assert((std::is_same<
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+ static_assert((std::is_same<typename C::difference_type,
+ typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+
+ static_assert((std::is_same<
typename std::iterator_traits<typename C::iterator>::iterator_category,
std::random_access_iterator_tag>::value), "");
static_assert((std::is_same<
{
typedef std::vector<T, Allocator> C;
+// TODO: These tests should use allocator_traits to get stuff, rather than
+// blindly pulling typedefs out of the allocator. This is why we can't call
+// test<int, min_allocator<int>>() below.
static_assert((std::is_same<typename C::value_type, T>::value), "");
static_assert((std::is_same<typename C::value_type, typename Allocator::value_type>::value), "");
static_assert((std::is_same<typename C::allocator_type, Allocator>::value), "");
static_assert((std::is_same<typename C::const_reference, typename Allocator::const_reference>::value), "");
static_assert((std::is_same<typename C::pointer, typename Allocator::pointer>::value), "");
static_assert((std::is_same<typename C::const_pointer, typename Allocator::const_pointer>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+
static_assert((std::is_same<
typename std::iterator_traits<typename C::iterator>::iterator_category,
std::random_access_iterator_tag>::value), "");
static_assert((std::is_same<std::vector<char>::allocator_type,
std::allocator<char> >::value), "");
#if __cplusplus >= 201103L
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::value_type, int>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::allocator_type, min_allocator<int> >::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::reference, int&>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::const_reference, const int&>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::pointer, min_pointer<int>>::value), "");
- static_assert((std::is_same<std::vector<int, min_allocator<int>>::const_pointer, min_pointer<const int>>::value), "");
+ {
+
+ typedef std::vector<int, min_allocator<int> > C;
+ static_assert((std::is_same<C::value_type, int>::value), "");
+ static_assert((std::is_same<C::allocator_type, min_allocator<int> >::value), "");
+ static_assert((std::is_same<C::reference, int&>::value), "");
+ static_assert((std::is_same<C::const_reference, const int&>::value), "");
+ static_assert((std::is_same<C::pointer, min_pointer<int>>::value), "");
+ static_assert((std::is_same<C::const_pointer, min_pointer<const int>>::value), "");
+
+ static_assert((std::is_signed<typename C::difference_type>::value), "");
+ static_assert((std::is_unsigned<typename C::size_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::iterator>::difference_type>::value), "");
+// static_assert((std::is_same<typename C::difference_type,
+// typename std::iterator_traits<typename C::const_iterator>::difference_type>::value), "");
+ }
#endif
}