forked from boostorg/range
Ticket 9851 - adaptors should perform concept check assertions.
This commit is contained in:
@@ -32,6 +32,30 @@ rule range-test ( name : includes * )
|
||||
|
||||
test-suite range :
|
||||
[ compile-fail compile_fail/iterator_range1.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept4.cpp ]
|
||||
[ range-test adaptor_test/adjacent_filtered ]
|
||||
[ range-test adaptor_test/copied ]
|
||||
[ range-test adaptor_test/filtered ]
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int, int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::adjacent_filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adjacent_filtered adaptor takes at least a
|
||||
// ForwardRange.
|
||||
return (mock_range<boost::single_pass_traversal_tag>() |
|
||||
adjacent_filtered(always_true())).front();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int, int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::adjacent_filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adjacent_filtered adaptor takes at least a
|
||||
// ForwardRange.
|
||||
return (mock_const_range<boost::single_pass_traversal_tag>() |
|
||||
adjacent_filtered(always_true())).front();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int, int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::adjacent_filter;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adjacent_filtered adaptor takes at least a
|
||||
// ForwardRange.
|
||||
return adjacent_filter(
|
||||
mock_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int, int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::adjacent_filter;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adjacent_filtered adaptor takes at least a
|
||||
// ForwardRange.
|
||||
return adjacent_filter(
|
||||
mock_const_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/range/adaptor/copied.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::copied;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return (mock_range<boost::bidirectional_traversal_tag>() |
|
||||
copied(0,1)).front();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/range/adaptor/copied.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::copied;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return (mock_const_range<boost::bidirectional_traversal_tag>() |
|
||||
copied(0,1)).front();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/range/adaptor/copied.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return boost::adaptors::copy(
|
||||
mock_range<boost::bidirectional_traversal_tag>(), 0, 1).front();
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/iterator/iterator_categories.hpp>
|
||||
#include <boost/range/adaptor/copied.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return boost::adaptors::copy(
|
||||
mock_const_range<boost::bidirectional_traversal_tag>(),
|
||||
0, 1).front();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return (mock_range<boost::single_pass_traversal_tag>() |
|
||||
filtered(always_true())).front();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return (mock_const_range<boost::single_pass_traversal_tag>() |
|
||||
filtered(always_true())).front();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::filter(
|
||||
mock_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::filter(
|
||||
mock_const_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
#ifndef BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_ITERATOR_HPP_INCLUDED
|
||||
#define BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_ITERATOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/iterator/iterator_facade.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
namespace unit_test
|
||||
{
|
||||
|
||||
template<typename TraversalTag>
|
||||
class mock_iterator
|
||||
: public boost::iterator_facade<
|
||||
mock_iterator<TraversalTag>,
|
||||
int,
|
||||
TraversalTag,
|
||||
const int&
|
||||
>
|
||||
{
|
||||
public:
|
||||
mock_iterator()
|
||||
: m_value(0)
|
||||
{
|
||||
}
|
||||
|
||||
explicit mock_iterator(int value)
|
||||
: m_value(value)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
void increment()
|
||||
{
|
||||
++m_value;
|
||||
}
|
||||
|
||||
void decrement()
|
||||
{
|
||||
--m_value;
|
||||
}
|
||||
|
||||
bool equal(const mock_iterator& other) const
|
||||
{
|
||||
return m_value == other.m_value;
|
||||
}
|
||||
|
||||
void advance(std::ptrdiff_t offset)
|
||||
{
|
||||
m_value += offset;
|
||||
}
|
||||
|
||||
std::ptrdiff_t distance_to(const mock_iterator& other) const
|
||||
{
|
||||
return other.m_value - m_value;
|
||||
}
|
||||
|
||||
const int& dereference() const
|
||||
{
|
||||
return m_value;
|
||||
}
|
||||
|
||||
int m_value;
|
||||
friend class boost::iterator_core_access;
|
||||
};
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace range
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,50 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
#ifndef BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_RANGE_HPP_INCLUDED
|
||||
#define BOOST_RANGE_UNIT_TEST_ADAPTOR_MOCK_RANGE_HPP_INCLUDED
|
||||
|
||||
#include "mock_iterator.hpp"
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range
|
||||
{
|
||||
namespace unit_test
|
||||
{
|
||||
|
||||
// Make a non-empty range that models the corresponding range concept.
|
||||
// This is only useful in unit tests. It is main use is to help test concepts
|
||||
// assertions are present.
|
||||
template<typename TraversalTag>
|
||||
iterator_range<mock_iterator<TraversalTag> >&
|
||||
mock_range()
|
||||
{
|
||||
static iterator_range<mock_iterator<TraversalTag> > instance(
|
||||
mock_iterator<TraversalTag>(0),
|
||||
mock_iterator<TraversalTag>(1));
|
||||
return instance;
|
||||
}
|
||||
|
||||
template<typename TraversalTag>
|
||||
const iterator_range<mock_iterator<TraversalTag> >&
|
||||
mock_const_range()
|
||||
{
|
||||
static iterator_range<mock_iterator<TraversalTag> > instance(
|
||||
mock_iterator<TraversalTag>(0),
|
||||
mock_iterator<TraversalTag>(1));
|
||||
return instance;
|
||||
}
|
||||
|
||||
} // namespace unit_test
|
||||
} // namespace range
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::reversed;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a BidirectionalRange.
|
||||
return (mock_range<boost::forward_traversal_tag>() | reversed).front();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::reversed;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a BidirectionalRange.
|
||||
return (mock_const_range<boost::forward_traversal_tag>() | reversed).front();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a BidirectionalRange.
|
||||
return boost::adaptors::reverse(
|
||||
mock_range<boost::forward_traversal_tag>()).front();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/reversed.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a BidirectionalRange.
|
||||
return boost::adaptors::reverse(
|
||||
mock_const_range<boost::forward_traversal_tag>()).front();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::sliced;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return (mock_range<boost::bidirectional_traversal_tag>() |
|
||||
sliced(0,1)).front();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::sliced;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return (mock_const_range<boost::bidirectional_traversal_tag>() |
|
||||
sliced(0,1)).front();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return boost::adaptors::slice(
|
||||
mock_range<boost::bidirectional_traversal_tag>(), 0, 1).front();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a RandomAccessRange.
|
||||
return boost::adaptors::slice(
|
||||
mock_const_range<boost::bidirectional_traversal_tag>(), 0, 1).front();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/uniqued.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::uniqued;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a ForwardRange.
|
||||
return (mock_range<boost::single_pass_traversal_tag>() | uniqued).front();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/uniqued.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::uniqued;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a ForwardRange.
|
||||
return (mock_const_range<boost::single_pass_traversal_tag>() |
|
||||
uniqued).front();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/uniqued.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::unique(
|
||||
mock_range<boost::single_pass_traversal_tag>()).front();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/uniqued.hpp>
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::unique(
|
||||
mock_const_range<boost::single_pass_traversal_tag>()).front();
|
||||
}
|
||||
Reference in New Issue
Block a user