mirror of
https://github.com/boostorg/iterator.git
synced 2025-07-29 20:37:17 +02:00
Moved input_output_iterator_tag to unit tests.
The class was not used anywhere else and was an implementation detail.
This commit is contained in:
@ -22,21 +22,6 @@ namespace boost {
|
||||
namespace iterators {
|
||||
namespace detail {
|
||||
|
||||
struct input_output_iterator_tag :
|
||||
public std::input_iterator_tag
|
||||
{
|
||||
// Using inheritance for only input_iterator_tag helps to avoid
|
||||
// ambiguities when a stdlib implementation dispatches on a
|
||||
// function which is overloaded on both input_iterator_tag and
|
||||
// output_iterator_tag, as STLPort does, in its __valid_range
|
||||
// function. I claim it's better to avoid the ambiguity in these
|
||||
// cases.
|
||||
operator std::output_iterator_tag() const
|
||||
{
|
||||
return std::output_iterator_tag();
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||
|
||||
template< typename T >
|
||||
|
@ -6,9 +6,25 @@
|
||||
|
||||
#include "static_assert_same.hpp"
|
||||
|
||||
#include <iterator>
|
||||
#include <type_traits>
|
||||
#include <boost/iterator/minimum_category.hpp>
|
||||
|
||||
struct input_output_iterator_tag :
|
||||
public std::input_iterator_tag
|
||||
{
|
||||
// Using inheritance for only input_iterator_tag helps to avoid
|
||||
// ambiguities when a stdlib implementation dispatches on a
|
||||
// function which is overloaded on both input_iterator_tag and
|
||||
// output_iterator_tag, as STLPort does, in its __valid_range
|
||||
// function. I claim it's better to avoid the ambiguity in these
|
||||
// cases.
|
||||
operator std::output_iterator_tag() const
|
||||
{
|
||||
return std::output_iterator_tag();
|
||||
}
|
||||
};
|
||||
|
||||
struct X { int a; };
|
||||
|
||||
|
||||
@ -43,7 +59,7 @@ void category_test()
|
||||
"std::input_iterator_tag is not expected to be convertible to input_output_iterator_tag.");
|
||||
|
||||
static_assert(
|
||||
!std::is_convertible<std::output_iterator_tag , input_output_iterator_tag>::value,
|
||||
!std::is_convertible<std::output_iterator_tag, input_output_iterator_tag>::value,
|
||||
"std::output_iterator_tag is not expected to be convertible to input_output_iterator_tag.");
|
||||
|
||||
static_assert(
|
||||
@ -65,31 +81,31 @@ void category_test()
|
||||
#endif
|
||||
|
||||
int test = static_assert_min_cat<
|
||||
std::input_iterator_tag,input_output_iterator_tag, std::input_iterator_tag
|
||||
std::input_iterator_tag, input_output_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
test = static_assert_min_cat<
|
||||
input_output_iterator_tag,std::input_iterator_tag, std::input_iterator_tag
|
||||
input_output_iterator_tag, std::input_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
#if 0
|
||||
test = static_assert_min_cat<
|
||||
input_output_iterator_tag,std::forward_iterator_tag, input_output_iterator_tag
|
||||
input_output_iterator_tag, std::forward_iterator_tag, input_output_iterator_tag
|
||||
>::value;
|
||||
#endif
|
||||
|
||||
test = static_assert_min_cat<
|
||||
std::input_iterator_tag,std::forward_iterator_tag, std::input_iterator_tag
|
||||
std::input_iterator_tag, std::forward_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
test = static_assert_min_cat<
|
||||
std::input_iterator_tag,std::random_access_iterator_tag, std::input_iterator_tag
|
||||
std::input_iterator_tag, std::random_access_iterator_tag, std::input_iterator_tag
|
||||
>::value;
|
||||
|
||||
#if 0 // This would be wrong: a random access iterator is not
|
||||
// neccessarily writable, as is an output iterator.
|
||||
test = static_assert_min_cat<
|
||||
std::output_iterator_tag,std::random_access_iterator_tag, std::output_iterator_tag
|
||||
std::output_iterator_tag, std::random_access_iterator_tag, std::output_iterator_tag
|
||||
>::value;
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user