diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/boost/libs/range/test/compile_fail | |
parent | Initial commit. (diff) | |
download | ceph-upstream/16.2.11+ds.tar.xz ceph-upstream/16.2.11+ds.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/boost/libs/range/test/compile_fail')
23 files changed, 678 insertions, 0 deletions
diff --git a/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept.cpp b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept.cpp new file mode 100644 index 000000000..e67215df9 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept2.cpp b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept2.cpp new file mode 100644 index 000000000..160f7c9d2 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept2.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept3.cpp b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept3.cpp new file mode 100644 index 000000000..310ac21ca --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept3.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept4.cpp b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept4.cpp new file mode 100644 index 000000000..f84b31ec3 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/adjacent_filtered_concept4.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/copied_concept.cpp b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept.cpp new file mode 100644 index 000000000..27e7f72d9 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/copied_concept2.cpp b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept2.cpp new file mode 100644 index 000000000..5df8ab6b9 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept2.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/copied_concept3.cpp b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept3.cpp new file mode 100644 index 000000000..da1659fb0 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept3.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/copied_concept4.cpp b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept4.cpp new file mode 100644 index 000000000..3df0a6c45 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/copied_concept4.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/mock_iterator.hpp b/src/boost/libs/range/test/compile_fail/adaptor/mock_iterator.hpp new file mode 100644 index 000000000..97f67a917 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/mock_iterator.hpp @@ -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 diff --git a/src/boost/libs/range/test/compile_fail/adaptor/mock_range.hpp b/src/boost/libs/range/test/compile_fail/adaptor/mock_range.hpp new file mode 100644 index 000000000..18fe2fa35 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/mock_range.hpp @@ -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 diff --git a/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept.cpp b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept.cpp new file mode 100644 index 000000000..5ad00419b --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept.cpp @@ -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(); +} + diff --git a/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept2.cpp b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept2.cpp new file mode 100644 index 000000000..e2b8cb6fd --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept2.cpp @@ -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(); +} + diff --git a/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept3.cpp b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept3.cpp new file mode 100644 index 000000000..619dfa8a8 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept3.cpp @@ -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(); +} + diff --git a/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept4.cpp b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept4.cpp new file mode 100644 index 000000000..0e183eea9 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/reversed_concept4.cpp @@ -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(); +} + diff --git a/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept.cpp b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept.cpp new file mode 100644 index 000000000..08a653f41 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept2.cpp b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept2.cpp new file mode 100644 index 000000000..996502039 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept2.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept3.cpp b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept3.cpp new file mode 100644 index 000000000..12749113d --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept3.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept4.cpp b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept4.cpp new file mode 100644 index 000000000..c7f8206a6 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/sliced_concept4.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept.cpp b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept.cpp new file mode 100644 index 000000000..bbaaf118c --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept2.cpp b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept2.cpp new file mode 100644 index 000000000..a390d1365 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept2.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept3.cpp b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept3.cpp new file mode 100644 index 000000000..fea058cc6 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept3.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept4.cpp b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept4.cpp new file mode 100644 index 000000000..1e0239048 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/adaptor/uniqued_concept4.cpp @@ -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(); +} diff --git a/src/boost/libs/range/test/compile_fail/iterator_range1.cpp b/src/boost/libs/range/test/compile_fail/iterator_range1.cpp new file mode 100644 index 000000000..2e5eec379 --- /dev/null +++ b/src/boost/libs/range/test/compile_fail/iterator_range1.cpp @@ -0,0 +1,22 @@ +// Boost.Range library +// +// Copyright Neil Groves 2011. 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 <boost/range/iterator_range_core.hpp> + +namespace iterator_range_test_detail +{ + void check_iterator_range_doesnt_convert_pointers() + { + double source[] = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 }; + boost::iterator_range<float*> rng = boost::make_iterator_range(source); + boost::ignore_unused_variable_warning(rng); + } +} + |