// -*- C++ -*-
// Iterator Wrappers for the C++ library testsuite.
//
-// Copyright (C) 2004-2019 Free Software Foundation, Inc.
+// Copyright (C) 2004-2020 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
#if __cplusplus >= 201103L
template<class U>
typename std::enable_if<std::is_assignable<T&, U>::value>::type
- operator=(U&& new_val)
+ operator=(U&& new_val) const
{
ITERATOR_VERIFY(SharedInfo->writtento[ptr - SharedInfo->first] == 0);
SharedInfo->writtento[ptr - SharedInfo->first] = 1;
void operator,(const T&, const output_iterator_wrapper<U>&) = delete;
#endif
-#if __cplusplus >= 2011L
+#if __cplusplus >= 201103L
using std::remove_cv;
#else
template<typename T> struct remove_cv { typedef T type; };
friend bool operator==(const sentinel& s, const I& i)
{ return s.end == i.ptr; }
-
- friend bool operator!=(const sentinel& s, const I& i)
- { return !(s == i); }
-
- friend bool operator==(const I& i, const sentinel& s)
- { return s == i; }
-
- friend bool operator!=(const I& i, const sentinel& s)
- { return !(s == i); }
};
auto
get_iterator(T* p)
{
- if constexpr (std::default_constructible<Iter<T>>)
+ if constexpr (std::default_initializable<Iter<T>>)
return Iter<T>(p, &bounds);
else
return iterator(p, &bounds);
typename Iter<T>::ContainerType bounds;
};
+ template<typename T>
+ using test_contiguous_range
+ = test_range<T, contiguous_iterator_wrapper>;
+ template<typename T>
+ using test_random_access_range
+ = test_range<T, random_access_iterator_wrapper>;
+ template<typename T>
+ using test_bidirectional_range
+ = test_range<T, bidirectional_iterator_wrapper>;
+ template<typename T>
+ using test_forward_range
+ = test_range<T, forward_iterator_wrapper>;
+ template<typename T>
+ using test_input_range
+ = test_range<T, input_iterator_wrapper>;
+ template<typename T>
+ using test_output_range
+ = test_range<T, output_iterator_wrapper>;
+
// A type meeting the minimum std::sized_range requirements
template<typename T, template<typename> class Iter>
struct test_sized_range : test_range<T, Iter>
std::size_t size() const noexcept
{ return this->bounds.size(); }
};
+
+ template<typename T>
+ using test_contiguous_sized_range
+ = test_sized_range<T, contiguous_iterator_wrapper>;
+ template<typename T>
+ using test_random_access_sized_range
+ = test_sized_range<T, random_access_iterator_wrapper>;
+ template<typename T>
+ using test_bidirectional_sized_range
+ = test_sized_range<T, bidirectional_iterator_wrapper>;
+ template<typename T>
+ using test_forward_sized_range
+ = test_sized_range<T, forward_iterator_wrapper>;
+ template<typename T>
+ using test_input_sized_range
+ = test_sized_range<T, input_iterator_wrapper>;
+ template<typename T>
+ using test_output_sized_range
+ = test_sized_range<T, output_iterator_wrapper>;
+
+// test_container, test_range and test_sized_range do not own their elements,
+// so they all model std::ranges::safe_range. This file does not define
+// specializations of std::ranges::enable_safe_range, so that individual
+// test can decide whether or not to do so.
#endif // C++20
} // namespace __gnu_test
#endif // _TESTSUITE_ITERATORS