Boost.RangeEx merged into Boost.Range

[SVN r60897]
This commit is contained in:
Neil Groves
2010-03-28 16:08:35 +00:00
parent 1461479a17
commit b0d1db7c2e
471 changed files with 48610 additions and 2065 deletions

View File

@ -0,0 +1,49 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_FUNCTIONS_CHECK_EQUAL_FN_HPP_INCLUDED
#define BOOST_RANGE_TEST_FUNCTIONS_CHECK_EQUAL_FN_HPP_INCLUDED
#include "counted_function.hpp"
namespace boost
{
namespace range_test_function
{
template< class Collection >
class check_equal_fn : private counted_function
{
typedef BOOST_DEDUCED_TYPENAME Collection::const_iterator iter_t;
public:
explicit check_equal_fn( const Collection& c )
: m_it(boost::begin(c)), m_last(boost::end(c)) {}
using counted_function::invocation_count;
void operator()(int x) const
{
invoked();
BOOST_CHECK( m_it != m_last );
if (m_it != m_last)
{
BOOST_CHECK_EQUAL( *m_it, x );
++m_it;
}
}
private:
mutable iter_t m_it;
iter_t m_last;
};
} // namespace range_test_function
} // namespace boost
#endif // include guard

View File

@ -0,0 +1,40 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_FUNCTION_COUNTED_FUNCTION_HPP_INCLUDED
#define BOOST_RANGE_TEST_FUNCTION_COUNTED_FUNCTION_HPP_INCLUDED
namespace boost
{
namespace range_test_function
{
class counted_function
{
public:
counted_function() : m_count(0u) {}
void invoked() const
{
++m_count;
}
// Return the number of times that this function object
// has been invoked.
unsigned int invocation_count() const { return m_count; }
private:
mutable unsigned int m_count;
};
}
}
#endif // include guard

View File

@ -0,0 +1,33 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_TEST_FUNCTION_EQUAL_TO_X_HPP_INCLUDED
#define BOOST_RANGE_TEST_TEST_FUNCTION_EQUAL_TO_X_HPP_INCLUDED
namespace boost
{
namespace range_test_function
{
template<class Arg>
struct equal_to_x
{
typedef bool result_type;
typedef Arg argument_type;
explicit equal_to_x(Arg x) : m_x(x) {}
bool operator()(Arg x) const { return x == m_x; }
private:
Arg m_x;
};
}
}
#endif // include guard

View File

@ -0,0 +1,29 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_TEST_FUNCTION_FALSE_PREDICATE_HPP_INCLUDED
#define BOOST_RANGE_TEST_TEST_FUNCTION_FALSE_PREDICATE_HPP_INCLUDED
namespace boost
{
namespace range_test_function
{
struct false_predicate
{
typedef bool result_type;
bool operator()() const { return false; }
template<class Arg> bool operator()(Arg) const { return false; }
template<class Arg1, class Arg2> bool operator()(Arg1,Arg2) const { return false; }
};
}
}
#endif // include guard

View File

@ -0,0 +1,32 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_FUNCTION_GREATER_THAN_X_HPP_INCLUDED
#define BOOST_RANGE_TEST_FUNCTION_GREATER_THAN_X_HPP_INCLUDED
namespace boost
{
namespace range_test_function
{
template< class Number >
struct greater_than_x
{
typedef bool result_type;
typedef Number argument_type;
explicit greater_than_x(Number x) : m_x(x) {}
bool operator()(Number x) const { return x > m_x; }
private:
Number m_x;
};
} // namespace range_test_function
} // namespace boost
#endif // include guard

View File

@ -0,0 +1,32 @@
// Boost.Range library
//
// Copyright Neil Groves 2009. 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_TEST_TEST_FUNCTION_MULTIPLY_BY_X_HPP_INCLUDED
#define BOOST_RANGE_TEST_TEST_FUNCTION_MULTIPLY_BY_X_HPP_INCLUDED
namespace boost
{
namespace range_test_function
{
template< class Arg >
struct multiply_by_x
{
typedef Arg result_type;
typedef Arg argument_type;
explicit multiply_by_x(Arg x) : m_x(x) {}
Arg operator()(Arg x) const { return x * m_x; }
private:
Arg m_x;
};
}
}
#endif // include guard