mirror of
https://github.com/boostorg/iterator.git
synced 2025-05-09 23:23:54 +00:00
Added a test for filter_iterator converting constructor.
This commit is contained in:
parent
1a7996ebd0
commit
c2b846c57d
@ -36,13 +36,13 @@ int main()
|
||||
// Concept checks
|
||||
// Adapting old-style iterators
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::input_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::input_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::SinglePassIteratorConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::input_output_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::input_output_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost::OutputIteratorConcept<Iter, dummyT> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
@ -50,39 +50,39 @@ int main()
|
||||
boost::function_requires< boost_concepts::SinglePassIteratorConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::forward_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::forward_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::ForwardIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::mutable_forward_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::mutable_forward_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::Mutable_ForwardIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::bidirectional_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::bidirectional_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::mutable_bidirectional_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::mutable_bidirectional_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::Mutable_BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::random_access_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::random_access_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::filter_iterator<one_or_four, boost::mutable_random_access_iterator_archetype<dummyT> > Iter;
|
||||
using Iter = boost::filter_iterator<one_or_four, boost::mutable_random_access_iterator_archetype<dummyT> >;
|
||||
boost::function_requires< boost::Mutable_BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
@ -90,24 +90,24 @@ int main()
|
||||
}
|
||||
// Adapting new-style iterators
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
const dummyT
|
||||
, boost::iterator_archetypes::readable_iterator_t
|
||||
, boost::single_pass_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::SinglePassIteratorConcept<Iter> >();
|
||||
}
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
dummyT
|
||||
, boost::iterator_archetypes::readable_writable_iterator_t
|
||||
, boost::single_pass_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost::OutputIteratorConcept<Iter, dummyT> >();
|
||||
@ -117,12 +117,12 @@ int main()
|
||||
}
|
||||
#endif
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
const dummyT
|
||||
, boost::iterator_archetypes::readable_iterator_t
|
||||
, boost::forward_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||
@ -130,35 +130,35 @@ int main()
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
dummyT
|
||||
, boost::iterator_archetypes::readable_writable_iterator_t
|
||||
, boost::forward_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
const dummyT
|
||||
, boost::iterator_archetypes::readable_lvalue_iterator_t
|
||||
, boost::forward_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::ForwardIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ForwardTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
dummyT
|
||||
, boost::iterator_archetypes::writable_lvalue_iterator_t
|
||||
, boost::forward_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::Mutable_ForwardIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||
@ -167,12 +167,12 @@ int main()
|
||||
#endif
|
||||
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
const dummyT
|
||||
, boost::iterator_archetypes::readable_iterator_t
|
||||
, boost::random_access_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::InputIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
@ -180,35 +180,35 @@ int main()
|
||||
|
||||
#if !BOOST_WORKAROUND(BOOST_MSVC, == 1200) // Causes Internal Error in linker.
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
dummyT
|
||||
, boost::iterator_archetypes::readable_writable_iterator_t
|
||||
, boost::random_access_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
const dummyT
|
||||
, boost::iterator_archetypes::readable_lvalue_iterator_t
|
||||
, boost::random_access_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::ReadableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::BidirectionalTraversalConcept<Iter> >();
|
||||
}
|
||||
{
|
||||
typedef boost::iterator_archetype<
|
||||
using BaseIter = boost::iterator_archetype<
|
||||
dummyT
|
||||
, boost::iterator_archetypes::writable_lvalue_iterator_t
|
||||
, boost::random_access_traversal_tag
|
||||
> BaseIter;
|
||||
typedef boost::filter_iterator<one_or_four, BaseIter> Iter;
|
||||
>;
|
||||
using Iter = boost::filter_iterator<one_or_four, BaseIter>;
|
||||
boost::function_requires< boost::Mutable_BidirectionalIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::WritableIteratorConcept<Iter> >();
|
||||
boost::function_requires< boost_concepts::LvalueIteratorConcept<Iter> >();
|
||||
@ -222,7 +222,7 @@ int main()
|
||||
dummyT(3), dummyT(4), dummyT(5) };
|
||||
const int N = sizeof(array)/sizeof(dummyT);
|
||||
|
||||
typedef boost::filter_iterator<one_or_four, dummyT*> filter_iter;
|
||||
using filter_iter = boost::filter_iterator<one_or_four, dummyT*>;
|
||||
|
||||
boost::bidirectional_readable_iterator_test(
|
||||
filter_iter(one_or_four(), array, array+N)
|
||||
@ -235,7 +235,13 @@ int main()
|
||||
>::value,
|
||||
"Filter interator must have a random_access_traversal_tag.");
|
||||
|
||||
//# endif
|
||||
// Check that the iterator can be constructed from a different but compatible iterator
|
||||
{
|
||||
using const_filter_iter = boost::filter_iterator<one_or_four, const dummyT*>;
|
||||
filter_iter mutable_it(one_or_four(), array+0, array+N);
|
||||
const_filter_iter const_it(mutable_it);
|
||||
(void)const_it;
|
||||
}
|
||||
|
||||
// On compilers not supporting partial specialization, we can do more type
|
||||
// deduction with deque iterators than with pointers... unless the library
|
||||
|
Loading…
x
Reference in New Issue
Block a user