Added boost header
This commit is contained in:
238
test/external/boost/range/adaptor/adjacent_filtered.hpp
vendored
Normal file
238
test/external/boost/range/adaptor/adjacent_filtered.hpp
vendored
Normal file
@@ -0,0 +1,238 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_ADJACENT_FILTER_IMPL_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_ADJACENT_FILTER_IMPL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4355 )
|
||||
#endif
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class Iter, class Pred, bool default_pass >
|
||||
class skip_iterator
|
||||
: public boost::iterator_adaptor<
|
||||
skip_iterator<Iter,Pred,default_pass>,
|
||||
Iter,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::value_type,
|
||||
boost::forward_traversal_tag,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::reference,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::difference_type
|
||||
>
|
||||
, private Pred
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_adaptor<
|
||||
skip_iterator<Iter,Pred,default_pass>,
|
||||
Iter,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::value_type,
|
||||
boost::forward_traversal_tag,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::reference,
|
||||
BOOST_DEDUCED_TYPENAME std::iterator_traits<Iter>::difference_type
|
||||
> base_t;
|
||||
|
||||
public:
|
||||
typedef Pred pred_t;
|
||||
typedef Iter iter_t;
|
||||
|
||||
skip_iterator() : m_last() {}
|
||||
|
||||
skip_iterator(iter_t it, iter_t last, const Pred& pred)
|
||||
: base_t(it)
|
||||
, pred_t(pred)
|
||||
, m_last(last)
|
||||
{
|
||||
move_to_next_valid();
|
||||
}
|
||||
|
||||
template<class OtherIter>
|
||||
skip_iterator( const skip_iterator<OtherIter, pred_t, default_pass>& other )
|
||||
: base_t(other.base())
|
||||
, pred_t(other)
|
||||
, m_last(other.m_last) {}
|
||||
|
||||
void move_to_next_valid()
|
||||
{
|
||||
iter_t& it = this->base_reference();
|
||||
pred_t& bi_pred = *this;
|
||||
if (it != m_last)
|
||||
{
|
||||
if (default_pass)
|
||||
{
|
||||
iter_t nxt = ::boost::next(it);
|
||||
while (nxt != m_last && !bi_pred(*it, *nxt))
|
||||
{
|
||||
++it;
|
||||
++nxt;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iter_t nxt = ::boost::next(it);
|
||||
for(; nxt != m_last; ++it, ++nxt)
|
||||
{
|
||||
if (bi_pred(*it, *nxt))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (nxt == m_last)
|
||||
{
|
||||
it = m_last;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void increment()
|
||||
{
|
||||
iter_t& it = this->base_reference();
|
||||
BOOST_ASSERT( it != m_last );
|
||||
++it;
|
||||
move_to_next_valid();
|
||||
}
|
||||
|
||||
iter_t m_last;
|
||||
};
|
||||
|
||||
template< class P, class R, bool default_pass >
|
||||
struct adjacent_filtered_range
|
||||
: iterator_range< skip_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type,
|
||||
P,
|
||||
default_pass
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef skip_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type,
|
||||
P,
|
||||
default_pass
|
||||
>
|
||||
skip_iter;
|
||||
|
||||
typedef iterator_range<skip_iter>
|
||||
base_range;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME range_iterator<R>::type raw_iterator;
|
||||
|
||||
public:
|
||||
adjacent_filtered_range( const P& p, R& r )
|
||||
: base_range(skip_iter(boost::begin(r), boost::end(r), p),
|
||||
skip_iter(boost::end(r), boost::end(r), p))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct adjacent_holder : holder<T>
|
||||
{
|
||||
adjacent_holder( T r ) : holder<T>(r)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct adjacent_excl_holder : holder<T>
|
||||
{
|
||||
adjacent_excl_holder( T r ) : holder<T>(r)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class ForwardRng, class BinPredicate >
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, true>
|
||||
operator|( ForwardRng& r,
|
||||
const adjacent_holder<BinPredicate>& f )
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, true>( f.val, r );
|
||||
}
|
||||
|
||||
template< class ForwardRng, class BinPredicate >
|
||||
inline adjacent_filtered_range<BinPredicate, const ForwardRng, true>
|
||||
operator|( const ForwardRng& r,
|
||||
const adjacent_holder<BinPredicate>& f )
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate,
|
||||
const ForwardRng, true>( f.val, r );
|
||||
}
|
||||
|
||||
template< class ForwardRng, class BinPredicate >
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, false>
|
||||
operator|( ForwardRng& r,
|
||||
const adjacent_excl_holder<BinPredicate>& f )
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, false>( f.val, r );
|
||||
}
|
||||
|
||||
template< class ForwardRng, class BinPredicate >
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, false>
|
||||
operator|( const ForwardRng& r,
|
||||
const adjacent_excl_holder<BinPredicate>& f )
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate,
|
||||
const ForwardRng, false>( f.val, r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
// Bring adjacent_filter_range into the boost namespace so that users of
|
||||
// this library may specify the return type of the '|' operator and
|
||||
// adjacent_filter()
|
||||
using range_detail::adjacent_filtered_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder<range_detail::adjacent_holder>
|
||||
adjacent_filtered =
|
||||
range_detail::forwarder<range_detail::adjacent_holder>();
|
||||
|
||||
const range_detail::forwarder<range_detail::adjacent_excl_holder>
|
||||
adjacent_filtered_excl =
|
||||
range_detail::forwarder<range_detail::adjacent_excl_holder>();
|
||||
}
|
||||
|
||||
template<class ForwardRng, class BinPredicate>
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, true>
|
||||
adjacent_filter(ForwardRng& rng, BinPredicate filter_pred)
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, true>(filter_pred, rng);
|
||||
}
|
||||
|
||||
template<class ForwardRng, class BinPredicate>
|
||||
inline adjacent_filtered_range<BinPredicate, const ForwardRng, true>
|
||||
adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred)
|
||||
{
|
||||
return adjacent_filtered_range<BinPredicate, const ForwardRng, true>(filter_pred, rng);
|
||||
}
|
||||
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
80
test/external/boost/range/adaptor/argument_fwd.hpp
vendored
Normal file
80
test/external/boost/range/adaptor/argument_fwd.hpp
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_ARGUMENT_FWD_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_ARGUMENT_FWD_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4512) // assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class T >
|
||||
struct holder
|
||||
{
|
||||
T val;
|
||||
holder( T t ) : val(t)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct holder2
|
||||
{
|
||||
T val1, val2;
|
||||
holder2( T t, T u ) : val1(t), val2(u)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< template<class> class Holder >
|
||||
struct forwarder
|
||||
{
|
||||
template< class T >
|
||||
Holder<T> operator()( T t ) const
|
||||
{
|
||||
return Holder<T>(t);
|
||||
}
|
||||
};
|
||||
|
||||
template< template<class> class Holder >
|
||||
struct forwarder2
|
||||
{
|
||||
template< class T >
|
||||
Holder<T> operator()( T t, T u ) const
|
||||
{
|
||||
return Holder<T>(t,u);
|
||||
}
|
||||
};
|
||||
|
||||
template< template<class,class> class Holder >
|
||||
struct forwarder2TU
|
||||
{
|
||||
template< class T, class U >
|
||||
Holder<T, U> operator()( T t, U u ) const
|
||||
{
|
||||
return Holder<T, U>(t, u);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
58
test/external/boost/range/adaptor/copied.hpp
vendored
Normal file
58
test/external/boost/range/adaptor/copied.hpp
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_COPIED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_COPIED_HPP
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace adaptors
|
||||
{
|
||||
struct copied
|
||||
{
|
||||
copied(std::size_t t_, std::size_t u_)
|
||||
: t(t_), u(u_) {}
|
||||
|
||||
std::size_t t;
|
||||
std::size_t u;
|
||||
};
|
||||
|
||||
template< class CopyableRandomAccessRng >
|
||||
inline CopyableRandomAccessRng
|
||||
operator|( const CopyableRandomAccessRng& r, const copied& f )
|
||||
{
|
||||
iterator_range<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const
|
||||
CopyableRandomAccessRng>::type >
|
||||
temp( adaptors::slice( r, f.t, f.u ) );
|
||||
return CopyableRandomAccessRng( temp.begin(), temp.end() );
|
||||
}
|
||||
|
||||
template<class CopyableRandomAccessRange>
|
||||
inline CopyableRandomAccessRange
|
||||
copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u)
|
||||
{
|
||||
iterator_range<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const
|
||||
CopyableRandomAccessRange>::type> temp(
|
||||
adaptors::slice(rng, t, u));
|
||||
|
||||
return CopyableRandomAccessRange( temp.begin(), temp.end() );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
109
test/external/boost/range/adaptor/define_adaptor.hpp
vendored
Normal file
109
test/external/boost/range/adaptor/define_adaptor.hpp
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2010. 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_DEFINE_ADAPTOR_HPP_INCLUDED
|
||||
#define BOOST_RANGE_DEFINE_ADAPTOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
||||
#define BOOST_DEFINE_RANGE_ADAPTOR( adaptor_name, range_adaptor ) \
|
||||
struct adaptor_name##_forwarder {}; \
|
||||
\
|
||||
template<typename Range> range_adaptor <Range> \
|
||||
operator|(Range& rng, adaptor_name##_forwarder) \
|
||||
{ \
|
||||
return range_adaptor <Range>( rng ); \
|
||||
} \
|
||||
\
|
||||
template<typename Range> range_adaptor <const Range> \
|
||||
operator|(const Range& rng, adaptor_name##_forwarder) \
|
||||
{ \
|
||||
return range_adaptor <const Range>( rng ); \
|
||||
} \
|
||||
\
|
||||
static adaptor_name##_forwarder adaptor_name = adaptor_name##_forwarder(); \
|
||||
\
|
||||
template<typename Range> \
|
||||
range_adaptor <Range> \
|
||||
make_##adaptor_name(Range& rng) \
|
||||
{ \
|
||||
return range_adaptor <Range>(rng); \
|
||||
} \
|
||||
\
|
||||
template<typename Range> \
|
||||
range_adaptor <const Range> \
|
||||
make_##adaptor_name(const Range& rng) \
|
||||
{ \
|
||||
return range_adaptor <const Range>(rng); \
|
||||
}
|
||||
|
||||
#define BOOST_DEFINE_RANGE_ADAPTOR_1( adaptor_name, range_adaptor, arg1_type ) \
|
||||
struct adaptor_name \
|
||||
{ \
|
||||
explicit adaptor_name (arg1_type arg1_) \
|
||||
: arg1(arg1_) {} \
|
||||
arg1_type arg1; \
|
||||
}; \
|
||||
\
|
||||
template<typename Range> range_adaptor <Range> \
|
||||
operator|(Range& rng, adaptor_name args) \
|
||||
{ \
|
||||
return range_adaptor <Range>(rng, args.arg1); \
|
||||
} \
|
||||
\
|
||||
template<typename Range> range_adaptor <const Range> \
|
||||
operator|(const Range& rng, adaptor_name args) \
|
||||
{ \
|
||||
return range_adaptor <const Range>(rng, args.arg1); \
|
||||
} \
|
||||
\
|
||||
template<typename Range> \
|
||||
range_adaptor <Range> \
|
||||
make_##adaptor_name(Range& rng, arg1_type arg1) \
|
||||
{ \
|
||||
return range_adaptor <Range>(rng, arg1); \
|
||||
} \
|
||||
\
|
||||
template<typename Range> \
|
||||
range_adaptor <const Range> \
|
||||
make_##adaptor_name(const Range& rng, arg1_type arg1) \
|
||||
{ \
|
||||
return range_adaptor <const Range>(rng, arg1); \
|
||||
}
|
||||
|
||||
#define BOOST_RANGE_ADAPTOR_2( adaptor_name, range_adaptor, arg1_type, arg2_type ) \
|
||||
struct adaptor_name \
|
||||
{ \
|
||||
explicit adaptor_name (arg1_type arg1_, arg2_type arg2_) \
|
||||
: arg1(arg1_), arg2(arg2_) {} \
|
||||
arg1_type arg1; \
|
||||
arg2_type arg2; \
|
||||
}; \
|
||||
\
|
||||
template<typename Range> range_adaptor <Range> \
|
||||
operator|(Range& rng, adaptor_name args) \
|
||||
{ \
|
||||
return range_adaptor <Range>(rng, args.arg1, args.arg2); \
|
||||
} \
|
||||
template<typename Range> \
|
||||
range_adaptor <Range> \
|
||||
make_##adaptor_name(Range& rng, arg1_type arg1, arg2_type arg2) \
|
||||
{ \
|
||||
return range_adaptor <Range>(rng, arg1, arg2); \
|
||||
} \
|
||||
template<typename Range> \
|
||||
range_adaptor <const Range> \
|
||||
make_##adaptor_name(const Range& rng, arg1_type arg1, arg2_type arg2) \
|
||||
{ \
|
||||
return range_adaptor <const Range>(rng, arg1, arg2); \
|
||||
}
|
||||
|
||||
|
||||
#endif // include guard
|
||||
101
test/external/boost/range/adaptor/filtered.hpp
vendored
Normal file
101
test/external/boost/range/adaptor/filtered.hpp
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_FILTERED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_FILTERED_HPP
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class P, class R >
|
||||
struct filtered_range :
|
||||
boost::iterator_range<
|
||||
boost::filter_iterator< P,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_range<
|
||||
boost::filter_iterator< P,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
> base;
|
||||
public:
|
||||
filtered_range( P p, R& r )
|
||||
: base( make_filter_iterator( p, boost::begin(r), boost::end(r) ),
|
||||
make_filter_iterator( p, boost::end(r), boost::end(r) ) )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct filter_holder : holder<T>
|
||||
{
|
||||
filter_holder( T r ) : holder<T>(r)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class InputRng, class Predicate >
|
||||
inline filtered_range<Predicate, InputRng>
|
||||
operator|( InputRng& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
{
|
||||
return filtered_range<Predicate, InputRng>( f.val, r );
|
||||
}
|
||||
|
||||
template< class InputRng, class Predicate >
|
||||
inline filtered_range<Predicate, const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
{
|
||||
return filtered_range<Predicate, const InputRng>( f.val, r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
// Unusual use of 'using' is intended to bring filter_range into the boost namespace
|
||||
// while leaving the mechanics of the '|' operator in range_detail and maintain
|
||||
// argument dependent lookup.
|
||||
// filter_range logically needs to be in the boost namespace to allow user of
|
||||
// the library to define the return type for filter()
|
||||
using range_detail::filtered_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder<range_detail::filter_holder>
|
||||
filtered =
|
||||
range_detail::forwarder<range_detail::filter_holder>();
|
||||
}
|
||||
|
||||
template<class InputRange, class Predicate>
|
||||
inline filtered_range<Predicate, InputRange>
|
||||
filter(InputRange& rng, Predicate filter_pred)
|
||||
{
|
||||
return range_detail::filtered_range<Predicate, InputRange>( filter_pred, rng );
|
||||
}
|
||||
|
||||
template<class InputRange, class Predicate>
|
||||
inline filtered_range<Predicate, const InputRange>
|
||||
filter(const InputRange& rng, Predicate filter_pred)
|
||||
{
|
||||
return range_detail::filtered_range<Predicate, const InputRange>( filter_pred, rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
156
test/external/boost/range/adaptor/indexed.hpp
vendored
Normal file
156
test/external/boost/range/adaptor/indexed.hpp
vendored
Normal file
@@ -0,0 +1,156 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_INDEXED_IMPL_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_INDEXED_IMPL_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4355 )
|
||||
#endif
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace adaptors
|
||||
{
|
||||
// This structure exists to carry the parameters from the '|' operator
|
||||
// to the index adapter. The expression rng | indexed(1) instantiates
|
||||
// this structure and passes it as the right-hand operand to the
|
||||
// '|' operator.
|
||||
struct indexed
|
||||
{
|
||||
explicit indexed(std::size_t x) : val(x) {}
|
||||
std::size_t val;
|
||||
};
|
||||
}
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
template< class Iter >
|
||||
class indexed_iterator
|
||||
: public boost::iterator_adaptor< indexed_iterator<Iter>, Iter >
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_adaptor< indexed_iterator<Iter>, Iter >
|
||||
base;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME base::difference_type index_type;
|
||||
|
||||
index_type m_index;
|
||||
|
||||
public:
|
||||
explicit indexed_iterator( Iter i, index_type index )
|
||||
: base(i), m_index(index)
|
||||
{
|
||||
BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" );
|
||||
}
|
||||
|
||||
index_type index() const
|
||||
{
|
||||
return m_index;
|
||||
}
|
||||
|
||||
private:
|
||||
friend class boost::iterator_core_access;
|
||||
|
||||
void increment()
|
||||
{
|
||||
++m_index;
|
||||
++(this->base_reference());
|
||||
}
|
||||
|
||||
|
||||
void decrement()
|
||||
{
|
||||
BOOST_ASSERT( m_index > 0 && "Indexed Iterator out of bounds" );
|
||||
--m_index;
|
||||
--(this->base_reference());
|
||||
}
|
||||
|
||||
void advance( index_type n )
|
||||
{
|
||||
m_index += n;
|
||||
BOOST_ASSERT( m_index >= 0 && "Indexed Iterator out of bounds" );
|
||||
this->base_reference() += n;
|
||||
}
|
||||
};
|
||||
|
||||
template< class Rng >
|
||||
struct indexed_range :
|
||||
iterator_range< indexed_iterator<BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type> >
|
||||
{
|
||||
private:
|
||||
typedef indexed_iterator<BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type>
|
||||
iter_type;
|
||||
typedef iterator_range<iter_type>
|
||||
base;
|
||||
public:
|
||||
template< class Index >
|
||||
indexed_range( Index i, Rng& r )
|
||||
: base( iter_type(boost::begin(r), i), iter_type(boost::end(r),i) )
|
||||
{ }
|
||||
};
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
// Make this available to users of this library. It will sometimes be
|
||||
// required since it is the return type of operator '|' and
|
||||
// index().
|
||||
using range_detail::indexed_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
template< class SinglePassRange >
|
||||
inline indexed_range<SinglePassRange>
|
||||
operator|( SinglePassRange& r,
|
||||
const indexed& f )
|
||||
{
|
||||
return indexed_range<SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
template< class SinglePassRange >
|
||||
inline indexed_range<const SinglePassRange>
|
||||
operator|( const SinglePassRange& r,
|
||||
const indexed& f )
|
||||
{
|
||||
return indexed_range<const SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class Index>
|
||||
inline indexed_range<SinglePassRange>
|
||||
index(SinglePassRange& rng, Index index_value)
|
||||
{
|
||||
return indexed_range<SinglePassRange>(index_value, rng);
|
||||
}
|
||||
|
||||
template<class SinglePassRange, class Index>
|
||||
inline indexed_range<const SinglePassRange>
|
||||
index(const SinglePassRange& rng, Index index_value)
|
||||
{
|
||||
return indexed_range<const SinglePassRange>(index_value, rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
#endif
|
||||
88
test/external/boost/range/adaptor/indirected.hpp
vendored
Normal file
88
test/external/boost/range/adaptor/indirected.hpp
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_INDIRECTED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_INDIRECTED_HPP
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class R >
|
||||
struct indirected_range :
|
||||
public boost::iterator_range<
|
||||
boost::indirect_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_range<
|
||||
boost::indirect_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
base;
|
||||
|
||||
public:
|
||||
explicit indirected_range( R& r )
|
||||
: base( r )
|
||||
{ }
|
||||
};
|
||||
|
||||
struct indirect_forwarder {};
|
||||
|
||||
template< class InputRng >
|
||||
inline indirected_range<InputRng>
|
||||
operator|( InputRng& r, indirect_forwarder )
|
||||
{
|
||||
return indirected_range<InputRng>( r );
|
||||
}
|
||||
|
||||
template< class InputRng >
|
||||
inline indirected_range<const InputRng>
|
||||
operator|( const InputRng& r, indirect_forwarder )
|
||||
{
|
||||
return indirected_range<const InputRng>( r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::indirected_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::indirect_forwarder indirected =
|
||||
range_detail::indirect_forwarder();
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline indirected_range<InputRange>
|
||||
indirect(InputRange& rng)
|
||||
{
|
||||
return indirected_range<InputRange>(rng);
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline indirected_range<const InputRange>
|
||||
indirect(const InputRange& rng)
|
||||
{
|
||||
return indirected_range<const InputRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
187
test/external/boost/range/adaptor/map.hpp
vendored
Normal file
187
test/external/boost/range/adaptor/map.hpp
vendored
Normal file
@@ -0,0 +1,187 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_MAP_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_MAP_HPP
|
||||
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/reference.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
struct map_keys_forwarder {};
|
||||
struct map_values_forwarder {};
|
||||
|
||||
template< class Map >
|
||||
struct select_first
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_reference<const Map>::type argument_type;
|
||||
typedef const BOOST_DEDUCED_TYPENAME range_value<const Map>::type::first_type& result_type;
|
||||
|
||||
result_type operator()( argument_type r ) const
|
||||
{
|
||||
return r.first;
|
||||
}
|
||||
};
|
||||
|
||||
template< class Map >
|
||||
struct select_second_mutable
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_reference<Map>::type argument_type;
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<Map>::type::second_type& result_type;
|
||||
|
||||
result_type operator()( argument_type r ) const
|
||||
{
|
||||
return r.second;
|
||||
}
|
||||
};
|
||||
|
||||
template< class Map >
|
||||
struct select_second_const
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME range_reference<const Map>::type argument_type;
|
||||
typedef const BOOST_DEDUCED_TYPENAME range_value<const Map>::type::second_type& result_type;
|
||||
|
||||
result_type operator()( argument_type r ) const
|
||||
{
|
||||
return r.second;
|
||||
}
|
||||
};
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_first_range
|
||||
: public transformed_range<
|
||||
select_first<StdPairRng>,
|
||||
const StdPairRng>
|
||||
{
|
||||
typedef transformed_range<select_first<StdPairRng>, const StdPairRng> base;
|
||||
public:
|
||||
typedef select_first<StdPairRng> transform_fn_type;
|
||||
typedef const StdPairRng source_range_type;
|
||||
|
||||
select_first_range(transform_fn_type fn, source_range_type& rng)
|
||||
: base(fn, rng)
|
||||
{
|
||||
}
|
||||
|
||||
select_first_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_second_mutable_range
|
||||
: public transformed_range<
|
||||
select_second_mutable<StdPairRng>,
|
||||
StdPairRng>
|
||||
{
|
||||
typedef transformed_range<select_second_mutable<StdPairRng>, StdPairRng> base;
|
||||
public:
|
||||
typedef select_second_mutable<StdPairRng> transform_fn_type;
|
||||
typedef StdPairRng source_range_type;
|
||||
|
||||
select_second_mutable_range(transform_fn_type fn, source_range_type& rng)
|
||||
: base(fn, rng)
|
||||
{
|
||||
}
|
||||
|
||||
select_second_mutable_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
template<class StdPairRng>
|
||||
class select_second_const_range
|
||||
: public transformed_range<
|
||||
select_second_const<StdPairRng>,
|
||||
const StdPairRng>
|
||||
{
|
||||
typedef transformed_range<select_second_const<StdPairRng>, const StdPairRng> base;
|
||||
public:
|
||||
typedef select_second_const<StdPairRng> transform_fn_type;
|
||||
typedef const StdPairRng source_range_type;
|
||||
|
||||
select_second_const_range(transform_fn_type fn, source_range_type& rng)
|
||||
: base(fn, rng)
|
||||
{
|
||||
}
|
||||
|
||||
select_second_const_range(const base& other) : base(other) {}
|
||||
};
|
||||
|
||||
template< class StdPairRng >
|
||||
inline select_first_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_keys_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_first<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
template< class StdPairRng >
|
||||
inline select_second_mutable_range<StdPairRng>
|
||||
operator|( StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_mutable<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
template< class StdPairRng >
|
||||
inline select_second_const_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_const<StdPairRng>() ) );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::select_first_range;
|
||||
using range_detail::select_second_mutable_range;
|
||||
using range_detail::select_second_const_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::map_keys_forwarder map_keys =
|
||||
range_detail::map_keys_forwarder();
|
||||
|
||||
const range_detail::map_values_forwarder map_values =
|
||||
range_detail::map_values_forwarder();
|
||||
}
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_first_range<StdPairRange>
|
||||
keys(const StdPairRange& rng)
|
||||
{
|
||||
return select_first_range<StdPairRange>(
|
||||
range_detail::select_first<StdPairRange>(), rng );
|
||||
}
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_second_const_range<StdPairRange>
|
||||
values(const StdPairRange& rng)
|
||||
{
|
||||
return select_second_const_range<StdPairRange>(
|
||||
range_detail::select_second_const<StdPairRange>(), rng );
|
||||
}
|
||||
|
||||
template<class StdPairRange>
|
||||
inline select_second_mutable_range<StdPairRange>
|
||||
values(StdPairRange& rng)
|
||||
{
|
||||
return select_second_mutable_range<StdPairRange>(
|
||||
range_detail::select_second_mutable<StdPairRange>(), rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
134
test/external/boost/range/adaptor/replaced.hpp
vendored
Normal file
134
test/external/boost/range/adaptor/replaced.hpp
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2007. 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_ADAPTOR_REPLACED_IMPL_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ADAPTOR_REPLACED_IMPL_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class Value >
|
||||
class replace_value
|
||||
{
|
||||
public:
|
||||
typedef const Value& result_type;
|
||||
typedef const Value& first_argument_type;
|
||||
|
||||
replace_value(const Value& from, const Value& to)
|
||||
: m_from(from), m_to(to)
|
||||
{
|
||||
}
|
||||
|
||||
const Value& operator()(const Value& x) const
|
||||
{
|
||||
return (x == m_from) ? m_to : x;
|
||||
}
|
||||
|
||||
private:
|
||||
Value m_from;
|
||||
Value m_to;
|
||||
};
|
||||
|
||||
template< class R >
|
||||
class replaced_range :
|
||||
public boost::iterator_range<
|
||||
boost::transform_iterator<
|
||||
replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type >,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > >
|
||||
{
|
||||
private:
|
||||
typedef replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type > Fn;
|
||||
|
||||
typedef boost::iterator_range<
|
||||
boost::transform_iterator<
|
||||
replace_value< BOOST_DEDUCED_TYPENAME range_value<R>::type >,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > > base_t;
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<R>::type value_type;
|
||||
|
||||
replaced_range( R& r, value_type from, value_type to )
|
||||
: base_t( make_transform_iterator( boost::begin(r), Fn(from, to) ),
|
||||
make_transform_iterator( boost::end(r), Fn(from, to) ) )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T >
|
||||
class replace_holder : public holder2<T>
|
||||
{
|
||||
public:
|
||||
replace_holder( const T& from, const T& to )
|
||||
: holder2<T>(from, to)
|
||||
{ }
|
||||
private:
|
||||
// not assignable
|
||||
void operator=(const replace_holder&);
|
||||
};
|
||||
|
||||
template< class InputRng >
|
||||
inline replaced_range<InputRng>
|
||||
operator|( InputRng& r,
|
||||
const replace_holder<BOOST_DEDUCED_TYPENAME range_value<InputRng>::type>& f )
|
||||
{
|
||||
return replaced_range<InputRng>(r, f.val1, f.val2);
|
||||
}
|
||||
|
||||
template< class InputRng >
|
||||
inline replaced_range<const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
const replace_holder<BOOST_DEDUCED_TYPENAME range_value<InputRng>::type>& f )
|
||||
{
|
||||
return replaced_range<const InputRng>(r, f.val1, f.val2);
|
||||
}
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::replaced_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder2<range_detail::replace_holder>
|
||||
replaced =
|
||||
range_detail::forwarder2<range_detail::replace_holder>();
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline replaced_range<InputRange>
|
||||
replace(InputRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<InputRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<InputRange>::type to)
|
||||
{
|
||||
return replaced_range<InputRange>(rng, from, to);
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline replaced_range<const InputRange>
|
||||
replace(const InputRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<const InputRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<const InputRange>::type to)
|
||||
{
|
||||
return replaced_range<const InputRange>(rng, from ,to);
|
||||
}
|
||||
|
||||
} // 'adaptors'
|
||||
} // 'boost'
|
||||
|
||||
#endif // include guard
|
||||
136
test/external/boost/range/adaptor/replaced_if.hpp
vendored
Normal file
136
test/external/boost/range/adaptor/replaced_if.hpp
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2007. 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_ADAPTOR_REPLACED_IF_IMPL_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ADAPTOR_REPLACED_IF_IMPL_HPP_INCLUDED
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class Pred, class Value >
|
||||
class replace_value_if
|
||||
{
|
||||
public:
|
||||
typedef const Value& result_type;
|
||||
typedef const Value& first_argument_type;
|
||||
|
||||
replace_value_if(const Pred& pred, const Value& to)
|
||||
: m_pred(pred), m_to(to)
|
||||
{
|
||||
}
|
||||
|
||||
const Value& operator()(const Value& x) const
|
||||
{
|
||||
return m_pred(x) ? m_to : x;
|
||||
}
|
||||
|
||||
private:
|
||||
Pred m_pred;
|
||||
Value m_to;
|
||||
};
|
||||
|
||||
template< class Pred, class R >
|
||||
class replaced_if_range :
|
||||
public boost::iterator_range<
|
||||
boost::transform_iterator<
|
||||
replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value<R>::type >,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > >
|
||||
{
|
||||
private:
|
||||
typedef replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value<R>::type > Fn;
|
||||
|
||||
typedef boost::iterator_range<
|
||||
boost::transform_iterator<
|
||||
replace_value_if< Pred, BOOST_DEDUCED_TYPENAME range_value<R>::type >,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type > > base_t;
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME range_value<R>::type value_type;
|
||||
|
||||
replaced_if_range( R& r, const Pred& pred, value_type to )
|
||||
: base_t( make_transform_iterator( boost::begin(r), Fn(pred, to) ),
|
||||
make_transform_iterator( boost::end(r), Fn(pred, to) ) )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class Pred, class T >
|
||||
class replace_if_holder
|
||||
{
|
||||
public:
|
||||
replace_if_holder( const Pred& pred, const T& to )
|
||||
: m_pred(pred), m_to(to)
|
||||
{ }
|
||||
|
||||
const Pred& pred() const { return m_pred; }
|
||||
const T& to() const { return m_to; }
|
||||
|
||||
private:
|
||||
Pred m_pred;
|
||||
T m_to;
|
||||
};
|
||||
|
||||
template< class Pred, class InputRng >
|
||||
inline replaced_if_range<Pred, InputRng>
|
||||
operator|( InputRng& r,
|
||||
const replace_if_holder<Pred, BOOST_DEDUCED_TYPENAME range_value<InputRng>::type>& f )
|
||||
{
|
||||
return replaced_if_range<Pred, InputRng>(r, f.pred(), f.to());
|
||||
}
|
||||
|
||||
template< class Pred, class InputRng >
|
||||
inline replaced_if_range<Pred, const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
const replace_if_holder<Pred, BOOST_DEDUCED_TYPENAME range_value<InputRng>::type>& f )
|
||||
{
|
||||
return replaced_if_range<Pred, const InputRng>(r, f.pred(), f.to());
|
||||
}
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::replaced_if_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder2TU<range_detail::replace_if_holder>
|
||||
replaced_if =
|
||||
range_detail::forwarder2TU<range_detail::replace_if_holder>();
|
||||
}
|
||||
|
||||
template<class Pred, class InputRange>
|
||||
inline replaced_if_range<Pred, InputRange>
|
||||
replace_if(InputRange& rng, Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<InputRange>::type to)
|
||||
{
|
||||
return range_detail::replaced_if_range<Pred, InputRange>(rng, pred, to);
|
||||
}
|
||||
|
||||
template<class Pred, class InputRange>
|
||||
inline replaced_if_range<Pred, const InputRange>
|
||||
replace_if(const InputRange& rng, Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<const InputRange>::type to)
|
||||
{
|
||||
return range_detail::replaced_if_range<Pred, const InputRange>(rng, pred, to);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
} // 'boost'
|
||||
|
||||
#endif // include guard
|
||||
90
test/external/boost/range/adaptor/reversed.hpp
vendored
Normal file
90
test/external/boost/range/adaptor/reversed.hpp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_REVERSED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_REVERSED_HPP
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
template< class R >
|
||||
struct reversed_range :
|
||||
public boost::iterator_range<
|
||||
boost::reverse_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_range<
|
||||
boost::reverse_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
base;
|
||||
|
||||
public:
|
||||
typedef boost::reverse_iterator<BOOST_DEDUCED_TYPENAME range_iterator<R>::type> iterator;
|
||||
|
||||
explicit reversed_range( R& r )
|
||||
: base( iterator(boost::end(r)), iterator(boost::begin(r)) )
|
||||
{ }
|
||||
};
|
||||
|
||||
struct reverse_forwarder {};
|
||||
|
||||
template< class BidirectionalRng >
|
||||
inline reversed_range<BidirectionalRng>
|
||||
operator|( BidirectionalRng& r, reverse_forwarder )
|
||||
{
|
||||
return reversed_range<BidirectionalRng>( r );
|
||||
}
|
||||
|
||||
template< class BidirectionalRng >
|
||||
inline reversed_range<const BidirectionalRng>
|
||||
operator|( const BidirectionalRng& r, reverse_forwarder )
|
||||
{
|
||||
return reversed_range<const BidirectionalRng>( r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::reversed_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::reverse_forwarder reversed =
|
||||
range_detail::reverse_forwarder();
|
||||
}
|
||||
|
||||
template<class BidirectionalRange>
|
||||
inline reversed_range<BidirectionalRange>
|
||||
reverse(BidirectionalRange& rng)
|
||||
{
|
||||
return reversed_range<BidirectionalRange>(rng);
|
||||
}
|
||||
|
||||
template<class BidirectionalRange>
|
||||
inline reversed_range<const BidirectionalRange>
|
||||
reverse(const BidirectionalRange& rng)
|
||||
{
|
||||
return reversed_range<const BidirectionalRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
} // 'boost'
|
||||
|
||||
#endif
|
||||
82
test/external/boost/range/adaptor/sliced.hpp
vendored
Normal file
82
test/external/boost/range/adaptor/sliced.hpp
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_SLICED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_SLICED_HPP
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace adaptors
|
||||
{
|
||||
struct sliced
|
||||
{
|
||||
sliced(std::size_t t_, std::size_t u_)
|
||||
: t(t_), u(u_) {}
|
||||
std::size_t t;
|
||||
std::size_t u;
|
||||
};
|
||||
|
||||
template< class RandomAccessRange >
|
||||
class sliced_range : public boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type >
|
||||
{
|
||||
typedef boost::iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<RandomAccessRange>::type > base_t;
|
||||
public:
|
||||
template<typename Rng, typename T, typename U>
|
||||
sliced_range(Rng& rng, T t, U u)
|
||||
: base_t(boost::make_iterator_range(rng, t, u - boost::size(rng)))
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template< class RandomAccessRange >
|
||||
inline sliced_range<RandomAccessRange>
|
||||
slice( RandomAccessRange& rng, std::size_t t, std::size_t u )
|
||||
{
|
||||
BOOST_ASSERT( t <= u && "error in slice indices" );
|
||||
BOOST_ASSERT( static_cast<std::size_t>(boost::size(rng)) >= u &&
|
||||
"second slice index out of bounds" );
|
||||
|
||||
return sliced_range<RandomAccessRange>(rng, t, u);
|
||||
}
|
||||
|
||||
template< class RandomAccessRange >
|
||||
inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type >
|
||||
slice( const RandomAccessRange& rng, std::size_t t, std::size_t u )
|
||||
{
|
||||
BOOST_ASSERT( t <= u && "error in slice indices" );
|
||||
BOOST_ASSERT( static_cast<std::size_t>(boost::size(rng)) >= u &&
|
||||
"second slice index out of bounds" );
|
||||
|
||||
return sliced_range<const RandomAccessRange>(rng, t, u);
|
||||
}
|
||||
|
||||
template< class RandomAccessRange >
|
||||
inline sliced_range<RandomAccessRange>
|
||||
operator|( RandomAccessRange& r, const sliced& f )
|
||||
{
|
||||
return sliced_range<RandomAccessRange>( r, f.t, f.u );
|
||||
}
|
||||
|
||||
template< class RandomAccessRange >
|
||||
inline sliced_range<const RandomAccessRange>
|
||||
operator|( const RandomAccessRange& r, const sliced& f )
|
||||
{
|
||||
return sliced_range<const RandomAccessRange>( r, f.t, f.u );
|
||||
}
|
||||
|
||||
} // namespace adaptors
|
||||
using adaptors::sliced_range;
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
350
test/external/boost/range/adaptor/strided.hpp
vendored
Normal file
350
test/external/boost/range/adaptor/strided.hpp
vendored
Normal file
@@ -0,0 +1,350 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2007. 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_ADAPTOR_STRIDED_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ADAPTOR_STRIDED_HPP_INCLUDED
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <iterator>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
// strided_iterator for wrapping a forward traversal iterator
|
||||
template<class BaseIterator, class Category>
|
||||
class strided_iterator
|
||||
: public iterator_adaptor<
|
||||
strided_iterator<BaseIterator, Category>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, boost::forward_traversal_tag
|
||||
>
|
||||
{
|
||||
friend class ::boost::iterator_core_access;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
strided_iterator<BaseIterator, Category>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, boost::forward_traversal_tag
|
||||
> super_t;
|
||||
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<BaseIterator>::difference_type difference_type;
|
||||
typedef BaseIterator base_iterator;
|
||||
|
||||
strided_iterator()
|
||||
: m_last()
|
||||
, m_stride()
|
||||
{
|
||||
}
|
||||
|
||||
strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride)
|
||||
: super_t(it)
|
||||
, m_last(last)
|
||||
, m_stride(stride)
|
||||
{
|
||||
}
|
||||
|
||||
template<class OtherIterator>
|
||||
strided_iterator(const strided_iterator<OtherIterator, Category>& other,
|
||||
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, base_iterator>::type* = 0)
|
||||
: super_t(other)
|
||||
, m_last(other.base_end())
|
||||
, m_stride(other.get_stride())
|
||||
{
|
||||
}
|
||||
|
||||
base_iterator base_end() const { return m_last; }
|
||||
difference_type get_stride() const { return m_stride; }
|
||||
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
base_iterator& it = this->base_reference();
|
||||
for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i)
|
||||
++it;
|
||||
}
|
||||
|
||||
base_iterator m_last;
|
||||
difference_type m_stride;
|
||||
};
|
||||
|
||||
// strided_iterator for wrapping a bidirectional iterator
|
||||
template<class BaseIterator>
|
||||
class strided_iterator<BaseIterator, bidirectional_traversal_tag>
|
||||
: public iterator_adaptor<
|
||||
strided_iterator<BaseIterator, bidirectional_traversal_tag>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, bidirectional_traversal_tag
|
||||
>
|
||||
{
|
||||
friend class ::boost::iterator_core_access;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
strided_iterator<BaseIterator, bidirectional_traversal_tag>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, bidirectional_traversal_tag
|
||||
> super_t;
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME std::iterator_traits<BaseIterator>::difference_type difference_type;
|
||||
typedef BaseIterator base_iterator;
|
||||
|
||||
strided_iterator()
|
||||
: m_first()
|
||||
, m_last()
|
||||
, m_stride()
|
||||
{
|
||||
}
|
||||
|
||||
strided_iterator(base_iterator first, base_iterator it, base_iterator last, difference_type stride)
|
||||
: super_t(it)
|
||||
, m_first(first)
|
||||
, m_last(last)
|
||||
, m_stride(stride)
|
||||
{
|
||||
}
|
||||
|
||||
template<class OtherIterator>
|
||||
strided_iterator(const strided_iterator<OtherIterator, bidirectional_traversal_tag>& other,
|
||||
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, base_iterator>::type* = 0)
|
||||
: super_t(other.base())
|
||||
, m_first(other.base_begin())
|
||||
, m_last(other.base_end())
|
||||
, m_stride(other.get_stride())
|
||||
{
|
||||
}
|
||||
|
||||
base_iterator base_begin() const { return m_first; }
|
||||
base_iterator base_end() const { return m_last; }
|
||||
difference_type get_stride() const { return m_stride; }
|
||||
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
base_iterator& it = this->base_reference();
|
||||
for (difference_type i = 0; (it != m_last) && (i < m_stride); ++i)
|
||||
++it;
|
||||
}
|
||||
|
||||
void decrement()
|
||||
{
|
||||
base_iterator& it = this->base_reference();
|
||||
for (difference_type i = 0; (it != m_first) && (i < m_stride); ++i)
|
||||
--it;
|
||||
}
|
||||
|
||||
base_iterator m_first;
|
||||
base_iterator m_last;
|
||||
difference_type m_stride;
|
||||
};
|
||||
|
||||
// strided_iterator implementation for wrapping a random access iterator
|
||||
template<class BaseIterator>
|
||||
class strided_iterator<BaseIterator, random_access_traversal_tag>
|
||||
: public iterator_adaptor<
|
||||
strided_iterator<BaseIterator, random_access_traversal_tag>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, random_access_traversal_tag
|
||||
>
|
||||
{
|
||||
friend class ::boost::iterator_core_access;
|
||||
|
||||
typedef iterator_adaptor<
|
||||
strided_iterator<BaseIterator, random_access_traversal_tag>
|
||||
, BaseIterator
|
||||
, use_default
|
||||
, random_access_traversal_tag
|
||||
> super_t;
|
||||
public:
|
||||
typedef BOOST_DEDUCED_TYPENAME super_t::difference_type difference_type;
|
||||
typedef BaseIterator base_iterator;
|
||||
|
||||
strided_iterator()
|
||||
: m_first()
|
||||
, m_last()
|
||||
, m_index(0)
|
||||
, m_stride()
|
||||
{
|
||||
}
|
||||
|
||||
strided_iterator(BaseIterator first, BaseIterator it, BaseIterator last, difference_type stride)
|
||||
: super_t(it)
|
||||
, m_first(first)
|
||||
, m_last(last)
|
||||
, m_index(stride ? (it - first) / stride : 0)
|
||||
, m_stride(stride)
|
||||
{
|
||||
}
|
||||
|
||||
template<class OtherIterator>
|
||||
strided_iterator(const strided_iterator<OtherIterator, random_access_traversal_tag>& other,
|
||||
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, BaseIterator>::type* = 0)
|
||||
: super_t(other.base())
|
||||
, m_first(other.base_begin())
|
||||
, m_last(other.base_end())
|
||||
, m_index(other.get_index())
|
||||
, m_stride(other.get_stride())
|
||||
{
|
||||
}
|
||||
|
||||
base_iterator base_begin() const { return m_first; }
|
||||
base_iterator base_end() const { return m_last; }
|
||||
difference_type get_stride() const { return m_stride; }
|
||||
difference_type get_index() const { return m_index; }
|
||||
|
||||
private:
|
||||
void increment()
|
||||
{
|
||||
m_index += m_stride;
|
||||
if (m_index < (m_last - m_first))
|
||||
this->base_reference() = m_first + m_index;
|
||||
else
|
||||
this->base_reference() = m_last;
|
||||
}
|
||||
|
||||
void decrement()
|
||||
{
|
||||
m_index -= m_stride;
|
||||
if (m_index >= 0)
|
||||
this->base_reference() = m_first + m_index;
|
||||
else
|
||||
this->base_reference() = m_first;
|
||||
}
|
||||
|
||||
void advance(difference_type offset)
|
||||
{
|
||||
offset *= m_stride;
|
||||
m_index += offset;
|
||||
if (m_index < 0)
|
||||
this->base_reference() = m_first;
|
||||
else if (m_index > (m_last - m_first))
|
||||
this->base_reference() = m_last;
|
||||
else
|
||||
this->base_reference() = m_first + m_index;
|
||||
}
|
||||
|
||||
template<class OtherIterator>
|
||||
difference_type distance_to(const strided_iterator<OtherIterator, random_access_traversal_tag>& other,
|
||||
BOOST_DEDUCED_TYPENAME enable_if_convertible<OtherIterator, BaseIterator>::type* = 0) const
|
||||
{
|
||||
if (other.base() >= this->base())
|
||||
return (other.base() - this->base() + (m_stride - 1)) / m_stride;
|
||||
return (other.base() - this->base() - (m_stride - 1)) / m_stride;
|
||||
}
|
||||
|
||||
bool equal(const strided_iterator& other) const
|
||||
{
|
||||
return this->base() == other.base();
|
||||
}
|
||||
|
||||
private:
|
||||
base_iterator m_first;
|
||||
base_iterator m_last;
|
||||
difference_type m_index;
|
||||
difference_type m_stride;
|
||||
};
|
||||
|
||||
template<class BaseIterator, class Difference> inline
|
||||
strided_iterator<BaseIterator, BOOST_DEDUCED_TYPENAME iterator_traversal<BaseIterator>::type>
|
||||
make_strided_iterator(BaseIterator first, BaseIterator it,
|
||||
BaseIterator last, Difference stride)
|
||||
{
|
||||
BOOST_ASSERT( stride >= 0 );
|
||||
typedef BOOST_DEDUCED_TYPENAME iterator_traversal<BaseIterator>::type traversal_tag;
|
||||
return strided_iterator<BaseIterator, traversal_tag>(first, it, last, stride);
|
||||
}
|
||||
|
||||
template< class Rng
|
||||
, class Category = BOOST_DEDUCED_TYPENAME iterator_traversal<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type
|
||||
>::type
|
||||
>
|
||||
class strided_range
|
||||
: public iterator_range<
|
||||
range_detail::strided_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type,
|
||||
Category
|
||||
>
|
||||
>
|
||||
{
|
||||
typedef range_detail::strided_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<Rng>::type,
|
||||
Category
|
||||
> iter_type;
|
||||
typedef iterator_range<iter_type> super_t;
|
||||
public:
|
||||
template<class Difference>
|
||||
strided_range(Difference stride, Rng& rng)
|
||||
: super_t(make_strided_iterator(boost::begin(rng), boost::begin(rng), boost::end(rng), stride),
|
||||
make_strided_iterator(boost::begin(rng), boost::end(rng), boost::end(rng), stride))
|
||||
{
|
||||
BOOST_ASSERT( stride >= 0 );
|
||||
}
|
||||
};
|
||||
|
||||
template<class Difference>
|
||||
class strided_holder : public holder<Difference>
|
||||
{
|
||||
public:
|
||||
explicit strided_holder(Difference value) : holder<Difference>(value) {}
|
||||
};
|
||||
|
||||
template<class Rng, class Difference>
|
||||
inline strided_range<Rng>
|
||||
operator|(Rng& rng, const strided_holder<Difference>& stride)
|
||||
{
|
||||
return strided_range<Rng>(stride.val, rng);
|
||||
}
|
||||
|
||||
template<class Rng, class Difference>
|
||||
inline strided_range<const Rng>
|
||||
operator|(const Rng& rng, const strided_holder<Difference>& stride)
|
||||
{
|
||||
return strided_range<const Rng>(stride.val, rng);
|
||||
}
|
||||
|
||||
} // namespace range_detail
|
||||
|
||||
using range_detail::strided_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder<range_detail::strided_holder>
|
||||
strided = range_detail::forwarder<range_detail::strided_holder>();
|
||||
}
|
||||
|
||||
template<class Range, class Difference>
|
||||
inline strided_range<Range>
|
||||
stride(Range& rng, Difference step)
|
||||
{
|
||||
return strided_range<Range>(step, rng);
|
||||
}
|
||||
|
||||
template<class Range, class Difference>
|
||||
inline strided_range<const Range>
|
||||
stride(const Range& rng, Difference step)
|
||||
{
|
||||
return strided_range<const Range>(step, rng);
|
||||
}
|
||||
|
||||
} // namespace 'adaptors'
|
||||
} // namespace 'boost'
|
||||
|
||||
#endif
|
||||
137
test/external/boost/range/adaptor/tokenized.hpp
vendored
Normal file
137
test/external/boost/range/adaptor/tokenized.hpp
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006. 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_ADAPTOR_TOKENIZED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_TOKENIZED_HPP
|
||||
|
||||
#include <boost/regex.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template< class R >
|
||||
struct tokenized_range :
|
||||
public boost::iterator_range<
|
||||
boost::regex_token_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef
|
||||
boost::regex_token_iterator<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
regex_iter;
|
||||
|
||||
typedef BOOST_DEDUCED_TYPENAME regex_iter::regex_type
|
||||
regex_type;
|
||||
|
||||
typedef boost::iterator_range<regex_iter>
|
||||
base;
|
||||
|
||||
public:
|
||||
template< class Regex, class Submatch, class Flag >
|
||||
tokenized_range( R& r, const Regex& re, const Submatch& sub, Flag f )
|
||||
: base( regex_iter( boost::begin(r), boost::end(r),
|
||||
regex_type(re), sub, f ),
|
||||
regex_iter() )
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T, class U, class V >
|
||||
struct regex_holder
|
||||
{
|
||||
const T& re;
|
||||
const U& sub;
|
||||
V f;
|
||||
|
||||
regex_holder( const T& rex, const U& subm, V flag ) :
|
||||
re(rex), sub(subm), f(flag)
|
||||
{ }
|
||||
private:
|
||||
// Not assignable
|
||||
void operator=(const regex_holder&);
|
||||
};
|
||||
|
||||
struct regex_forwarder
|
||||
{
|
||||
template< class Regex >
|
||||
regex_holder<Regex,int,regex_constants::match_flag_type>
|
||||
operator()( const Regex& re,
|
||||
int submatch = 0,
|
||||
regex_constants::match_flag_type f =
|
||||
regex_constants::match_default ) const
|
||||
{
|
||||
return regex_holder<Regex,int,
|
||||
regex_constants::match_flag_type>( re, submatch, f );
|
||||
}
|
||||
|
||||
template< class Regex, class Submatch >
|
||||
regex_holder<Regex,Submatch,regex_constants::match_flag_type>
|
||||
operator()( const Regex& re,
|
||||
const Submatch& sub,
|
||||
regex_constants::match_flag_type f =
|
||||
regex_constants::match_default ) const
|
||||
{
|
||||
return regex_holder<Regex,Submatch,
|
||||
regex_constants::match_flag_type>( re, sub, f );
|
||||
}
|
||||
};
|
||||
|
||||
template< class BidirectionalRng, class R, class S, class F >
|
||||
inline tokenized_range<BidirectionalRng>
|
||||
operator|( BidirectionalRng& r,
|
||||
const regex_holder<R,S,F>& f )
|
||||
{
|
||||
return tokenized_range<BidirectionalRng>( r, f.re, f.sub, f.f );
|
||||
}
|
||||
|
||||
template< class BidirectionalRng, class R, class S, class F >
|
||||
inline tokenized_range<const BidirectionalRng>
|
||||
operator|( const BidirectionalRng& r,
|
||||
const regex_holder<R,S,F>& f )
|
||||
{
|
||||
return tokenized_range<const BidirectionalRng>( r, f.re, f.sub, f.f );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::tokenized_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::regex_forwarder tokenized =
|
||||
range_detail::regex_forwarder();
|
||||
}
|
||||
|
||||
template<class BidirectionalRange, class Regex, class Submatch, class Flag>
|
||||
inline tokenized_range<BidirectionalRange>
|
||||
tokenize(BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f)
|
||||
{
|
||||
return tokenized_range<BidirectionalRange>(rng, reg, sub, f);
|
||||
}
|
||||
|
||||
template<class BidirectionalRange, class Regex, class Submatch, class Flag>
|
||||
inline tokenized_range<const BidirectionalRange>
|
||||
tokenize(const BidirectionalRange& rng, const Regex& reg, const Submatch& sub, Flag f)
|
||||
{
|
||||
return tokenized_range<const BidirectionalRange>(rng, reg, sub, f);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
104
test/external/boost/range/adaptor/transformed.hpp
vendored
Normal file
104
test/external/boost/range/adaptor/transformed.hpp
vendored
Normal file
@@ -0,0 +1,104 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_TRANSFORMED_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_TRANSFORMED_HPP
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace range_detail
|
||||
{
|
||||
|
||||
template< class F, class R >
|
||||
struct transformed_range :
|
||||
public boost::iterator_range<
|
||||
boost::transform_iterator< F,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
private:
|
||||
typedef boost::iterator_range<
|
||||
boost::transform_iterator< F,
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<R>::type
|
||||
>
|
||||
>
|
||||
base;
|
||||
|
||||
public:
|
||||
typedef F transform_fn_type;
|
||||
typedef R source_range_type;
|
||||
|
||||
transformed_range( F f, R& r )
|
||||
: base( boost::make_transform_iterator( boost::begin(r), f ),
|
||||
boost::make_transform_iterator( boost::end(r), f ) )
|
||||
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class T >
|
||||
struct transform_holder : holder<T>
|
||||
{
|
||||
transform_holder( T r ) : holder<T>(r)
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class InputRng, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction,InputRng>
|
||||
operator|( InputRng& r,
|
||||
const transform_holder<UnaryFunction>& f )
|
||||
{
|
||||
return transformed_range<UnaryFunction,InputRng>( f.val, r );
|
||||
}
|
||||
|
||||
template< class InputRng, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction, const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
const transform_holder<UnaryFunction>& f )
|
||||
{
|
||||
return transformed_range<UnaryFunction, const InputRng>( f.val, r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::transformed_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::forwarder<range_detail::transform_holder>
|
||||
transformed =
|
||||
range_detail::forwarder<range_detail::transform_holder>();
|
||||
}
|
||||
|
||||
template<class UnaryFunction, class InputRange>
|
||||
inline transformed_range<UnaryFunction, InputRange>
|
||||
transform(InputRange& rng, UnaryFunction fn)
|
||||
{
|
||||
return transformed_range<UnaryFunction, InputRange>(fn, rng);
|
||||
}
|
||||
|
||||
template<class UnaryFunction, class InputRange>
|
||||
inline transformed_range<UnaryFunction, const InputRange>
|
||||
transform(const InputRange& rng, UnaryFunction fn)
|
||||
{
|
||||
return transformed_range<UnaryFunction, const InputRange>(fn, rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
184
test/external/boost/range/adaptor/type_erased.hpp
vendored
Normal file
184
test/external/boost/range/adaptor/type_erased.hpp
vendored
Normal file
@@ -0,0 +1,184 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2010. 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_ADAPTOR_TYPE_ERASED_HPP_INCLUDED
|
||||
#define BOOST_RANGE_ADAPTOR_TYPE_ERASED_HPP_INCLUDED
|
||||
|
||||
#include <boost/range/reference.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/any_range.hpp>
|
||||
#include <boost/cast.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace adaptors
|
||||
{
|
||||
template<
|
||||
class Value = use_default
|
||||
, class Traversal = use_default
|
||||
, class Reference = use_default
|
||||
, class Difference = use_default
|
||||
, class Buffer = use_default
|
||||
>
|
||||
struct type_erased
|
||||
{
|
||||
};
|
||||
|
||||
template<
|
||||
class SinglePassRange
|
||||
, class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type
|
||||
operator|(SinglePassRange& rng,
|
||||
type_erased<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>)
|
||||
{
|
||||
typedef typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type range_type;
|
||||
return range_type(boost::begin(rng), boost::end(rng));
|
||||
}
|
||||
|
||||
template<
|
||||
class SinglePassRange
|
||||
, class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type
|
||||
operator|(const SinglePassRange& rng,
|
||||
type_erased<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>)
|
||||
{
|
||||
typedef typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type range_type;
|
||||
return range_type(boost::begin(rng), boost::end(rng));
|
||||
}
|
||||
|
||||
template<
|
||||
class SinglePassRange
|
||||
, class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type
|
||||
type_erase(SinglePassRange& rng
|
||||
, type_erased<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
> = type_erased<>()
|
||||
)
|
||||
{
|
||||
typedef typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type range_type;
|
||||
|
||||
return range_type(boost::begin(rng), boost::end(rng));
|
||||
}
|
||||
|
||||
template<
|
||||
class SinglePassRange
|
||||
, class Value
|
||||
, class Traversal
|
||||
, class Reference
|
||||
, class Difference
|
||||
, class Buffer
|
||||
>
|
||||
typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type
|
||||
type_erase(const SinglePassRange& rng
|
||||
, type_erased<
|
||||
Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
> = type_erased<>()
|
||||
)
|
||||
{
|
||||
typedef typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
, Traversal
|
||||
, Reference
|
||||
, Difference
|
||||
, Buffer
|
||||
>::type range_type;
|
||||
|
||||
return range_type(boost::begin(rng), boost::end(rng));
|
||||
}
|
||||
}
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
90
test/external/boost/range/adaptor/uniqued.hpp
vendored
Normal file
90
test/external/boost/range/adaptor/uniqued.hpp
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. 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_ADAPTOR_UNIQUED_IMPL_HPP
|
||||
#define BOOST_RANGE_ADAPTOR_UNIQUED_IMPL_HPP
|
||||
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace range_detail
|
||||
{
|
||||
struct unique_forwarder { };
|
||||
|
||||
struct unique_not_equal_to
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
template< class T >
|
||||
bool operator()( const T& l, const T& r ) const
|
||||
{
|
||||
return !(l == r);
|
||||
}
|
||||
};
|
||||
|
||||
template<class ForwardRng>
|
||||
class uniqued_range : public adjacent_filtered_range<unique_not_equal_to, ForwardRng, true>
|
||||
{
|
||||
typedef adjacent_filtered_range<unique_not_equal_to, ForwardRng, true> base;
|
||||
public:
|
||||
explicit uniqued_range(ForwardRng& rng)
|
||||
: base(unique_not_equal_to(), rng)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
template< class ForwardRng >
|
||||
inline uniqued_range<ForwardRng>
|
||||
operator|( ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
return uniqued_range<ForwardRng>(r);
|
||||
}
|
||||
|
||||
template< class ForwardRng >
|
||||
inline uniqued_range<const ForwardRng>
|
||||
operator|( const ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
return uniqued_range<const ForwardRng>(r);
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
|
||||
using range_detail::uniqued_range;
|
||||
|
||||
namespace adaptors
|
||||
{
|
||||
namespace
|
||||
{
|
||||
const range_detail::unique_forwarder uniqued =
|
||||
range_detail::unique_forwarder();
|
||||
}
|
||||
|
||||
template<class ForwardRange>
|
||||
inline uniqued_range<ForwardRange>
|
||||
unique(ForwardRange& rng)
|
||||
{
|
||||
return uniqued_range<ForwardRange>(rng);
|
||||
}
|
||||
|
||||
template<class ForwardRange>
|
||||
inline uniqued_range<const ForwardRange>
|
||||
unique(const ForwardRange& rng)
|
||||
{
|
||||
return uniqued_range<const ForwardRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user