early-access version 3088

This commit is contained in:
pineappleEA
2022-11-05 15:35:56 +01:00
parent 4e4fc25ce3
commit b601909c6d
35519 changed files with 5996896 additions and 860 deletions

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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);
}
}