forked from boostorg/iterator
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 iterators {
|
||||||
namespace detail {
|
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
|
#ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY
|
||||||
|
|
||||||
template< typename T >
|
template< typename T >
|
||||||
|
@ -6,9 +6,25 @@
|
|||||||
|
|
||||||
#include "static_assert_same.hpp"
|
#include "static_assert_same.hpp"
|
||||||
|
|
||||||
|
#include <iterator>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <boost/iterator/minimum_category.hpp>
|
#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; };
|
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.");
|
"std::input_iterator_tag is not expected to be convertible to input_output_iterator_tag.");
|
||||||
|
|
||||||
static_assert(
|
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.");
|
"std::output_iterator_tag is not expected to be convertible to input_output_iterator_tag.");
|
||||||
|
|
||||||
static_assert(
|
static_assert(
|
||||||
@ -65,31 +81,31 @@ void category_test()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
|
|
||||||
test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
|
|
||||||
test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
|
|
||||||
#if 0 // This would be wrong: a random access iterator is not
|
#if 0 // This would be wrong: a random access iterator is not
|
||||||
// neccessarily writable, as is an output iterator.
|
// neccessarily writable, as is an output iterator.
|
||||||
test = static_assert_min_cat<
|
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;
|
>::value;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user