forked from boostorg/range
Ticket 9851 - adaptors should perform concept check assertions.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* [*Postcondition:] For all adjacent elements `[x]` in the returned range, `pred(x)` is `true`.
|
||||
* [*Throws:] Whatever the copy constructor of `pred` might throw.
|
||||
* [*Range Category:] __forward_range__
|
||||
* [*Range Return Type:] `boost::filtered_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::filtered_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The minimum of the range category of `rng` and __bidirectional_range__
|
||||
|
||||
[section:filtered_example filtered example]
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
* [*Returns:] A range adapted to return both the element and the associated index. The returned range consists of iterators that have in addition to the usual iterator member functions an `index()` member function that returns the appropriate index for the element in the sequence corresponding with the iterator.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::indexed_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::indexed_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`
|
||||
|
||||
[section:indexed_example indexed example]
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] The `value_type` of the range defines unary `operator*()`
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `*y` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::indirected_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::indirected_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`
|
||||
|
||||
[section:indirected_example indirected example]
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] The `value_type` of the range is an instantiation of `std::pair`.
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.first` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::select_first_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::select_first_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:map_keys_example map_keys example]
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] The `value_type` of the range is an instantiation of `std::pair`.
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `y.second` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] for constant ranges, `boost::select_second_const<typeof(rng)>` otherwise `boost:select_second_mutable<typeof(rng)>`
|
||||
* [*Range Return Type:] for constant ranges, `boost::select_second_const<decltype(rng)>` otherwise `boost:select_second_mutable<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:map_values_example map_values example]
|
||||
|
@ -15,8 +15,8 @@
|
||||
* `new_value` is convertible to the `value_type` of the range.
|
||||
* `old_value` is convertible to the `value_type` of the range.
|
||||
* [*Postcondition:] For all elements `x` in the returned range, the value `x` is equal to the value of `(y == old_value) ? new_value : y` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __forward_range__
|
||||
* [*Range Return Type:] `boost::replaced_range<typeof(rng)>`
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::replaced_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:replaced_example replaced example]
|
||||
|
@ -15,8 +15,8 @@
|
||||
* The range `value_type` is convertible to the argument type of `pred`.
|
||||
* `new_value` is convertible to the `value_type` of the range.
|
||||
* [*Postconditions:] For all elements `x` in the returned range, the value `x` is equal to the value of `pred(y) ? new_value : y` where `y` is the corresponding element in the original range.
|
||||
* [*Range Category:] __forward_range__
|
||||
* [*Range Return Type:] `boost::replaced_if_range<typeof(rng)>`
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::replaced_if_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:replaced_if_example replaced_if example]
|
||||
|
@ -13,7 +13,7 @@
|
||||
|
||||
* [*Returns:] A range whose iterators behave as if they were the original iterators wrapped in `reverse_iterator`.
|
||||
* [*Range Category:] __bidirectional_range__
|
||||
* [*Range Return Type:] `boost::reversed_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::reversed_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:reversed_example reversed example]
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] `0 <= n && n <= m && m < distance(rng)`
|
||||
* [*Returns:] `make_range(rng, n, m)`
|
||||
* [*Range Category:] __random_access_range__
|
||||
* [*Range Return Type:] `boost::sliced_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::sliced_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] __random_access_range__
|
||||
|
||||
[section:sliced_example sliced example]
|
||||
|
@ -41,7 +41,7 @@
|
||||
* [*Returns:] A range whose iterators behave as if they were the original iterators wrapped in `regex_token_iterator`. The first iterator in the range would be constructed by forwarding all the arguments of `tokenized()` to the `regex_token_iterator` constructor.
|
||||
* [*Throws:] Whatever constructing and copying equivalent `regex_token_iterator`s might throw.
|
||||
* [*Range Category:] __random_access_range__
|
||||
* [*Range Return Type:] `boost::tokenized_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::tokenized_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] __random_access_range__
|
||||
|
||||
[section:tokenized_example tokenized_example]
|
||||
|
@ -15,7 +15,7 @@
|
||||
* [*Postcondition:] For all elements `x` in the returned range, `x` is the result of `fun(y)` where `y` is the corresponding element in the original range.
|
||||
* [*Throws:] Whatever the copy-constructor of `fun` might throw.
|
||||
* [*Range Category:] __single_pass_range__
|
||||
* [*Range Return Type:] `boost::transformed_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::transformed_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The range category of `rng`.
|
||||
|
||||
[section:transformed_example transformed example]
|
||||
|
@ -14,7 +14,7 @@
|
||||
* [*Precondition:] The `value_type` of the range is comparable with `operator==()`.
|
||||
* [*Postcondition:] For all adjacent elements `[x,y]` in the returned range, `x==y` is false.
|
||||
* [*Range Category:] __forward_range__
|
||||
* [*Range Return Type:] `boost::uniqued_range<typeof(rng)>`
|
||||
* [*Range Return Type:] `boost::uniqued_range<decltype(rng)>`
|
||||
* [*Returned Range Category:] The minimum of the range concept of `rng` and __forward_range__.
|
||||
|
||||
[section:uniqued_example uniqued example]
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
|
||||
@ -154,6 +155,8 @@ namespace boost
|
||||
operator|( ForwardRng& r,
|
||||
const adjacent_holder<BinPredicate>& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRng>));
|
||||
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, true>( f.val, r );
|
||||
}
|
||||
|
||||
@ -162,6 +165,8 @@ namespace boost
|
||||
operator|( const ForwardRng& r,
|
||||
const adjacent_holder<BinPredicate>& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRng>));
|
||||
|
||||
return adjacent_filtered_range<BinPredicate,
|
||||
const ForwardRng, true>( f.val, r );
|
||||
}
|
||||
@ -171,6 +176,7 @@ namespace boost
|
||||
operator|( ForwardRng& r,
|
||||
const adjacent_excl_holder<BinPredicate>& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRng>));
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, false>( f.val, r );
|
||||
}
|
||||
|
||||
@ -179,6 +185,7 @@ namespace boost
|
||||
operator|( const ForwardRng& r,
|
||||
const adjacent_excl_holder<BinPredicate>& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRng>));
|
||||
return adjacent_filtered_range<BinPredicate,
|
||||
const ForwardRng, false>( f.val, r );
|
||||
}
|
||||
@ -207,6 +214,7 @@ namespace boost
|
||||
inline adjacent_filtered_range<BinPredicate, ForwardRng, true>
|
||||
adjacent_filter(ForwardRng& rng, BinPredicate filter_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRng>));
|
||||
return adjacent_filtered_range<BinPredicate, ForwardRng, true>(filter_pred, rng);
|
||||
}
|
||||
|
||||
@ -214,6 +222,7 @@ namespace boost
|
||||
inline adjacent_filtered_range<BinPredicate, const ForwardRng, true>
|
||||
adjacent_filter(const ForwardRng& rng, BinPredicate filter_pred)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRng>));
|
||||
return adjacent_filtered_range<BinPredicate, const ForwardRng, true>(filter_pred, rng);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Thorsten Ottosen, Neil Groves 2006 - 2008. Use, modification and
|
||||
// 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)
|
||||
@ -15,6 +15,7 @@
|
||||
#include <boost/range/adaptor/sliced.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -29,25 +30,34 @@ namespace boost
|
||||
std::size_t u;
|
||||
};
|
||||
|
||||
template< class CopyableRandomAccessRng >
|
||||
inline CopyableRandomAccessRng
|
||||
operator|( const CopyableRandomAccessRng& r, const copied& f )
|
||||
template<class CopyableRandomAccessRange>
|
||||
inline CopyableRandomAccessRange
|
||||
operator|(const CopyableRandomAccessRange& r, const copied& f)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<const CopyableRandomAccessRange>));
|
||||
|
||||
iterator_range<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const
|
||||
CopyableRandomAccessRng>::type >
|
||||
temp( adaptors::slice( r, f.t, f.u ) );
|
||||
return CopyableRandomAccessRng( temp.begin(), temp.end() );
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
const CopyableRandomAccessRange
|
||||
>::type
|
||||
> temp(adaptors::slice(r, f.t, f.u));
|
||||
|
||||
return CopyableRandomAccessRange(temp.begin(), temp.end());
|
||||
}
|
||||
|
||||
template<class CopyableRandomAccessRange>
|
||||
inline CopyableRandomAccessRange
|
||||
copy(const CopyableRandomAccessRange& rng, std::size_t t, std::size_t u)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<const CopyableRandomAccessRange>));
|
||||
|
||||
iterator_range<
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<const
|
||||
CopyableRandomAccessRange>::type> temp(
|
||||
adaptors::slice(rng, t, u));
|
||||
BOOST_DEDUCED_TYPENAME range_iterator<
|
||||
const CopyableRandomAccessRange
|
||||
>::type
|
||||
> temp(adaptors::slice(rng, t, u));
|
||||
|
||||
return CopyableRandomAccessRange( temp.begin(), temp.end() );
|
||||
}
|
||||
@ -55,4 +65,4 @@ namespace boost
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif // include guard
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/filter_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -47,20 +48,23 @@ namespace boost
|
||||
{ }
|
||||
};
|
||||
|
||||
template< class InputRng, class Predicate >
|
||||
inline filtered_range<Predicate, InputRng>
|
||||
operator|( InputRng& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
template< class ForwardRange, class Predicate >
|
||||
inline filtered_range<Predicate, ForwardRange>
|
||||
operator|(ForwardRange& r,
|
||||
const filter_holder<Predicate>& f)
|
||||
{
|
||||
return filtered_range<Predicate, InputRng>( f.val, r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
return filtered_range<Predicate, ForwardRange>( f.val, r );
|
||||
}
|
||||
|
||||
template< class InputRng, class Predicate >
|
||||
inline filtered_range<Predicate, const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
template< class ForwardRange, class Predicate >
|
||||
inline filtered_range<Predicate, const ForwardRange>
|
||||
operator|(const ForwardRange& r,
|
||||
const filter_holder<Predicate>& f )
|
||||
{
|
||||
return filtered_range<Predicate, const InputRng>( f.val, r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
return filtered_range<Predicate, const ForwardRange>( f.val, r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
@ -81,18 +85,23 @@ namespace boost
|
||||
range_detail::forwarder<range_detail::filter_holder>();
|
||||
}
|
||||
|
||||
template<class InputRange, class Predicate>
|
||||
inline filtered_range<Predicate, InputRange>
|
||||
filter(InputRange& rng, Predicate filter_pred)
|
||||
template<class ForwardRange, class Predicate>
|
||||
inline filtered_range<Predicate, ForwardRange>
|
||||
filter(ForwardRange& rng, Predicate filter_pred)
|
||||
{
|
||||
return range_detail::filtered_range<Predicate, InputRange>( filter_pred, rng );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
|
||||
return range_detail::filtered_range<Predicate, ForwardRange>( filter_pred, rng );
|
||||
}
|
||||
|
||||
template<class InputRange, class Predicate>
|
||||
inline filtered_range<Predicate, const InputRange>
|
||||
filter(const InputRange& rng, Predicate filter_pred)
|
||||
template<class ForwardRange, class Predicate>
|
||||
inline filtered_range<Predicate, const ForwardRange>
|
||||
filter(const ForwardRange& rng, Predicate filter_pred)
|
||||
{
|
||||
return range_detail::filtered_range<Predicate, const InputRange>( filter_pred, rng );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
|
||||
return range_detail::filtered_range<Predicate, const ForwardRange>( filter_pred, rng );
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
|
||||
|
||||
@ -124,6 +125,9 @@ namespace boost
|
||||
operator|( SinglePassRange& r,
|
||||
const indexed& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return indexed_range<SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
@ -132,6 +136,9 @@ namespace boost
|
||||
operator|( const SinglePassRange& r,
|
||||
const indexed& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return indexed_range<const SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
@ -139,6 +146,9 @@ namespace boost
|
||||
inline indexed_range<SinglePassRange>
|
||||
index(SinglePassRange& rng, Index index_value)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return indexed_range<SinglePassRange>(index_value, rng);
|
||||
}
|
||||
|
||||
@ -146,6 +156,9 @@ namespace boost
|
||||
inline indexed_range<const SinglePassRange>
|
||||
index(const SinglePassRange& rng, Index index_value)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return indexed_range<const SinglePassRange>(index_value, rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define BOOST_RANGE_ADAPTOR_INDIRECTED_HPP
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/indirect_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -42,18 +43,24 @@ namespace boost
|
||||
|
||||
struct indirect_forwarder {};
|
||||
|
||||
template< class InputRng >
|
||||
inline indirected_range<InputRng>
|
||||
operator|( InputRng& r, indirect_forwarder )
|
||||
template< class SinglePassRange >
|
||||
inline indirected_range<SinglePassRange>
|
||||
operator|( SinglePassRange& r, indirect_forwarder )
|
||||
{
|
||||
return indirected_range<InputRng>( r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return indirected_range<SinglePassRange>( r );
|
||||
}
|
||||
|
||||
template< class InputRng >
|
||||
inline indirected_range<const InputRng>
|
||||
operator|( const InputRng& r, indirect_forwarder )
|
||||
template< class SinglePassRange >
|
||||
inline indirected_range<const SinglePassRange>
|
||||
operator|( const SinglePassRange& r, indirect_forwarder )
|
||||
{
|
||||
return indirected_range<const InputRng>( r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return indirected_range<const SinglePassRange>( r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
@ -68,18 +75,23 @@ namespace boost
|
||||
range_detail::indirect_forwarder();
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline indirected_range<InputRange>
|
||||
indirect(InputRange& rng)
|
||||
template<class SinglePassRange>
|
||||
inline indirected_range<SinglePassRange>
|
||||
indirect(SinglePassRange& rng)
|
||||
{
|
||||
return indirected_range<InputRange>(rng);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
return indirected_range<SinglePassRange>(rng);
|
||||
}
|
||||
|
||||
template<class InputRange>
|
||||
inline indirected_range<const InputRange>
|
||||
indirect(const InputRange& rng)
|
||||
template<class SinglePassRange>
|
||||
inline indirected_range<const SinglePassRange>
|
||||
indirect(const SinglePassRange& rng)
|
||||
{
|
||||
return indirected_range<const InputRange>(rng);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return indirected_range<const SinglePassRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/reference.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -120,6 +121,9 @@ namespace boost
|
||||
inline select_first_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_keys_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const StdPairRng>));
|
||||
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_first<StdPairRng>() ) );
|
||||
}
|
||||
@ -128,6 +132,8 @@ namespace boost
|
||||
inline select_second_mutable_range<StdPairRng>
|
||||
operator|( StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<StdPairRng>));
|
||||
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_mutable<StdPairRng>() ) );
|
||||
}
|
||||
@ -136,6 +142,9 @@ namespace boost
|
||||
inline select_second_const_range<StdPairRng>
|
||||
operator|( const StdPairRng& r, map_values_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const StdPairRng>));
|
||||
|
||||
return operator|( r,
|
||||
boost::adaptors::transformed( select_second_const<StdPairRng>() ) );
|
||||
}
|
||||
@ -161,6 +170,9 @@ namespace boost
|
||||
inline select_first_range<StdPairRange>
|
||||
keys(const StdPairRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const StdPairRange>));
|
||||
|
||||
return select_first_range<StdPairRange>(
|
||||
range_detail::select_first<StdPairRange>(), rng );
|
||||
}
|
||||
@ -169,6 +181,9 @@ namespace boost
|
||||
inline select_second_const_range<StdPairRange>
|
||||
values(const StdPairRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const StdPairRange>));
|
||||
|
||||
return select_second_const_range<StdPairRange>(
|
||||
range_detail::select_second_const<StdPairRange>(), rng );
|
||||
}
|
||||
@ -177,6 +192,8 @@ namespace boost
|
||||
inline select_second_mutable_range<StdPairRange>
|
||||
values(StdPairRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((SinglePassRangeConcept<StdPairRange>));
|
||||
|
||||
return select_second_mutable_range<StdPairRange>(
|
||||
range_detail::select_second_mutable<StdPairRange>(), rng );
|
||||
}
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
@ -82,20 +83,30 @@ namespace boost
|
||||
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 )
|
||||
template< class SinglePassRange >
|
||||
inline replaced_range<SinglePassRange>
|
||||
operator|(
|
||||
SinglePassRange& r,
|
||||
const replace_holder<
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f )
|
||||
{
|
||||
return replaced_range<InputRng>(r, f.val1, f.val2);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return replaced_range<SinglePassRange>(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 )
|
||||
template< class SinglePassRange >
|
||||
inline replaced_range<const SinglePassRange>
|
||||
operator|(
|
||||
const SinglePassRange& r,
|
||||
const replace_holder<
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
{
|
||||
return replaced_range<const InputRng>(r, f.val1, f.val2);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return replaced_range<const SinglePassRange>(r, f.val1, f.val2);
|
||||
}
|
||||
} // 'range_detail'
|
||||
|
||||
@ -110,22 +121,28 @@ namespace boost
|
||||
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)
|
||||
template<class SinglePassRange>
|
||||
inline replaced_range<SinglePassRange>
|
||||
replace(SinglePassRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
{
|
||||
return replaced_range<InputRange>(rng, from, to);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return replaced_range<SinglePassRange>(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)
|
||||
template<class SinglePassRange>
|
||||
inline replaced_range<const SinglePassRange>
|
||||
replace(const SinglePassRange& rng,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type from,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
{
|
||||
return replaced_range<const InputRange>(rng, from ,to);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return replaced_range<const SinglePassRange>(rng, from ,to);
|
||||
}
|
||||
|
||||
} // 'adaptors'
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <boost/range/begin.hpp>
|
||||
#include <boost/range/end.hpp>
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
|
||||
@ -86,20 +87,34 @@ namespace boost
|
||||
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 )
|
||||
template< class Pred, class SinglePassRange >
|
||||
inline replaced_if_range<Pred, SinglePassRange>
|
||||
operator|(
|
||||
SinglePassRange& r,
|
||||
const replace_if_holder<
|
||||
Pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
{
|
||||
return replaced_if_range<Pred, InputRng>(r, f.pred(), f.to());
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return replaced_if_range<Pred, SinglePassRange>(
|
||||
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 )
|
||||
template< class Pred, class SinglePassRange >
|
||||
inline replaced_if_range<Pred, const SinglePassRange>
|
||||
operator|(
|
||||
const SinglePassRange& r,
|
||||
const replace_if_holder<
|
||||
Pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type>& f)
|
||||
{
|
||||
return replaced_if_range<Pred, const InputRng>(r, f.pred(), f.to());
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return replaced_if_range<Pred, const SinglePassRange>(
|
||||
r, f.pred(), f.to());
|
||||
}
|
||||
} // 'range_detail'
|
||||
|
||||
@ -113,24 +128,34 @@ namespace boost
|
||||
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)
|
||||
|
||||
template<class Pred, class SinglePassRange>
|
||||
inline replaced_if_range<Pred, SinglePassRange>
|
||||
replace_if(SinglePassRange& rng, Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<SinglePassRange>::type to)
|
||||
{
|
||||
return range_detail::replaced_if_range<Pred, InputRange>(rng, pred, to);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return range_detail::replaced_if_range<Pred, SinglePassRange>(
|
||||
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)
|
||||
template<class Pred, class SinglePassRange>
|
||||
inline replaced_if_range<Pred, const SinglePassRange>
|
||||
replace_if(
|
||||
const SinglePassRange& rng,
|
||||
Pred pred,
|
||||
BOOST_DEDUCED_TYPENAME range_value<const SinglePassRange>::type to)
|
||||
{
|
||||
return range_detail::replaced_if_range<Pred, const InputRange>(rng, pred, to);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return range_detail::replaced_if_range<Pred, const SinglePassRange>(
|
||||
rng, pred, to);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
||||
} // 'boost'
|
||||
|
||||
#endif // include guard
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define BOOST_RANGE_ADAPTOR_REVERSED_HPP
|
||||
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/reverse_iterator.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -44,18 +45,24 @@ namespace boost
|
||||
|
||||
struct reverse_forwarder {};
|
||||
|
||||
template< class BidirectionalRng >
|
||||
inline reversed_range<BidirectionalRng>
|
||||
operator|( BidirectionalRng& r, reverse_forwarder )
|
||||
template< class BidirectionalRange >
|
||||
inline reversed_range<BidirectionalRange>
|
||||
operator|( BidirectionalRange& r, reverse_forwarder )
|
||||
{
|
||||
return reversed_range<BidirectionalRng>( r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
BidirectionalRangeConcept<BidirectionalRange>));
|
||||
|
||||
return reversed_range<BidirectionalRange>( r );
|
||||
}
|
||||
|
||||
template< class BidirectionalRng >
|
||||
inline reversed_range<const BidirectionalRng>
|
||||
operator|( const BidirectionalRng& r, reverse_forwarder )
|
||||
|
||||
template< class BidirectionalRange >
|
||||
inline reversed_range<const BidirectionalRange>
|
||||
operator|( const BidirectionalRange& r, reverse_forwarder )
|
||||
{
|
||||
return reversed_range<const BidirectionalRng>( r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
BidirectionalRangeConcept<const BidirectionalRange>));
|
||||
|
||||
return reversed_range<const BidirectionalRange>( r );
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
@ -74,6 +81,9 @@ namespace boost
|
||||
inline reversed_range<BidirectionalRange>
|
||||
reverse(BidirectionalRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
BidirectionalRangeConcept<BidirectionalRange>));
|
||||
|
||||
return reversed_range<BidirectionalRange>(rng);
|
||||
}
|
||||
|
||||
@ -81,6 +91,9 @@ namespace boost
|
||||
inline reversed_range<const BidirectionalRange>
|
||||
reverse(const BidirectionalRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
BidirectionalRangeConcept<const BidirectionalRange>));
|
||||
|
||||
return reversed_range<const BidirectionalRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/size_type.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -44,6 +45,9 @@ namespace boost
|
||||
inline sliced_range<RandomAccessRange>
|
||||
slice( RandomAccessRange& rng, std::size_t t, std::size_t u )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<RandomAccessRange>));
|
||||
|
||||
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" );
|
||||
@ -55,6 +59,9 @@ namespace boost
|
||||
inline iterator_range< BOOST_DEDUCED_TYPENAME range_iterator<const RandomAccessRange>::type >
|
||||
slice( const RandomAccessRange& rng, std::size_t t, std::size_t u )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<const RandomAccessRange>));
|
||||
|
||||
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" );
|
||||
@ -66,6 +73,9 @@ namespace boost
|
||||
inline sliced_range<RandomAccessRange>
|
||||
operator|( RandomAccessRange& r, const sliced& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<RandomAccessRange>));
|
||||
|
||||
return sliced_range<RandomAccessRange>( r, f.t, f.u );
|
||||
}
|
||||
|
||||
@ -73,6 +83,9 @@ namespace boost
|
||||
inline sliced_range<const RandomAccessRange>
|
||||
operator|( const RandomAccessRange& r, const sliced& f )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
RandomAccessRangeConcept<const RandomAccessRange>));
|
||||
|
||||
return sliced_range<const RandomAccessRange>( r, f.t, f.u );
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include <boost/range/adaptor/argument_fwd.hpp>
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/iterator/transform_iterator.hpp>
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
@ -57,20 +58,27 @@ namespace boost
|
||||
}
|
||||
};
|
||||
|
||||
template< class InputRng, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction,InputRng>
|
||||
operator|( InputRng& r,
|
||||
template< class SinglePassRange, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction,SinglePassRange>
|
||||
operator|( SinglePassRange& r,
|
||||
const transform_holder<UnaryFunction>& f )
|
||||
{
|
||||
return transformed_range<UnaryFunction,InputRng>( f.val, r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return transformed_range<UnaryFunction,SinglePassRange>( f.val, r );
|
||||
}
|
||||
|
||||
template< class InputRng, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction, const InputRng>
|
||||
operator|( const InputRng& r,
|
||||
template< class SinglePassRange, class UnaryFunction >
|
||||
inline transformed_range<UnaryFunction, const SinglePassRange>
|
||||
operator|( const SinglePassRange& r,
|
||||
const transform_holder<UnaryFunction>& f )
|
||||
{
|
||||
return transformed_range<UnaryFunction, const InputRng>( f.val, r );
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return transformed_range<UnaryFunction, const SinglePassRange>(
|
||||
f.val, r);
|
||||
}
|
||||
|
||||
} // 'range_detail'
|
||||
@ -86,18 +94,25 @@ namespace boost
|
||||
range_detail::forwarder<range_detail::transform_holder>();
|
||||
}
|
||||
|
||||
template<class UnaryFunction, class InputRange>
|
||||
inline transformed_range<UnaryFunction, InputRange>
|
||||
transform(InputRange& rng, UnaryFunction fn)
|
||||
template<class UnaryFunction, class SinglePassRange>
|
||||
inline transformed_range<UnaryFunction, SinglePassRange>
|
||||
transform(SinglePassRange& rng, UnaryFunction fn)
|
||||
{
|
||||
return transformed_range<UnaryFunction, InputRange>(fn, rng);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
return transformed_range<UnaryFunction, SinglePassRange>(fn, rng);
|
||||
}
|
||||
|
||||
template<class UnaryFunction, class InputRange>
|
||||
inline transformed_range<UnaryFunction, const InputRange>
|
||||
transform(const InputRange& rng, UnaryFunction fn)
|
||||
template<class UnaryFunction, class SinglePassRange>
|
||||
inline transformed_range<UnaryFunction, const SinglePassRange>
|
||||
transform(const SinglePassRange& rng, UnaryFunction fn)
|
||||
{
|
||||
return transformed_range<UnaryFunction, const InputRange>(fn, rng);
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
return transformed_range<UnaryFunction, const SinglePassRange>(
|
||||
fn, rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include <boost/range/value_type.hpp>
|
||||
#include <boost/range/iterator_range_core.hpp>
|
||||
#include <boost/range/any_range.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
#include <boost/cast.hpp>
|
||||
|
||||
namespace boost
|
||||
@ -56,6 +57,9 @@ namespace boost
|
||||
, Buffer
|
||||
>)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
typedef typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
@ -92,6 +96,9 @@ namespace boost
|
||||
, Buffer
|
||||
>)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
typedef typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
@ -129,6 +136,9 @@ namespace boost
|
||||
> = type_erased<>()
|
||||
)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<SinglePassRange>));
|
||||
|
||||
typedef typename any_range_type_generator<
|
||||
SinglePassRange
|
||||
, Value
|
||||
@ -167,6 +177,9 @@ namespace boost
|
||||
> = type_erased<>()
|
||||
)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
SinglePassRangeConcept<const SinglePassRange>));
|
||||
|
||||
typedef typename any_range_type_generator<
|
||||
const SinglePassRange
|
||||
, Value
|
||||
|
@ -12,6 +12,7 @@
|
||||
#define BOOST_RANGE_ADAPTOR_UNIQUED_IMPL_HPP
|
||||
|
||||
#include <boost/range/adaptor/adjacent_filtered.hpp>
|
||||
#include <boost/range/concepts.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -47,6 +48,7 @@ namespace boost
|
||||
operator|( ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRng>));
|
||||
return uniqued_range<ForwardRng>(r);
|
||||
}
|
||||
|
||||
@ -55,6 +57,7 @@ namespace boost
|
||||
operator|( const ForwardRng& r,
|
||||
unique_forwarder )
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<const ForwardRng>));
|
||||
return uniqued_range<const ForwardRng>(r);
|
||||
}
|
||||
|
||||
@ -74,6 +77,7 @@ namespace boost
|
||||
inline uniqued_range<ForwardRange>
|
||||
unique(ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((ForwardRangeConcept<ForwardRange>));
|
||||
return uniqued_range<ForwardRange>(rng);
|
||||
}
|
||||
|
||||
@ -81,6 +85,9 @@ namespace boost
|
||||
inline uniqued_range<const ForwardRange>
|
||||
unique(const ForwardRange& rng)
|
||||
{
|
||||
BOOST_RANGE_CONCEPT_ASSERT((
|
||||
ForwardRangeConcept<const ForwardRange>));
|
||||
|
||||
return uniqued_range<const ForwardRange>(rng);
|
||||
}
|
||||
} // 'adaptors'
|
||||
|
@ -32,6 +32,30 @@ rule range-test ( name : includes * )
|
||||
|
||||
test-suite range :
|
||||
[ compile-fail compile_fail/iterator_range1.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/adjacent_filtered_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/copied_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/filtered_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/reversed_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/sliced_concept4.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept2.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept3.cpp ]
|
||||
[ compile-fail compile_fail/adaptor/uniqued_concept4.cpp ]
|
||||
[ range-test adaptor_test/adjacent_filtered ]
|
||||
[ range-test adaptor_test/copied ]
|
||||
[ range-test adaptor_test/filtered ]
|
||||
|
39
test/compile_fail/adaptor/adjacent_filtered_concept.cpp
Normal file
39
test/compile_fail/adaptor/adjacent_filtered_concept.cpp
Normal 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();
|
||||
}
|
39
test/compile_fail/adaptor/adjacent_filtered_concept2.cpp
Normal file
39
test/compile_fail/adaptor/adjacent_filtered_concept2.cpp
Normal 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();
|
||||
}
|
40
test/compile_fail/adaptor/adjacent_filtered_concept3.cpp
Normal file
40
test/compile_fail/adaptor/adjacent_filtered_concept3.cpp
Normal 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();
|
||||
}
|
40
test/compile_fail/adaptor/adjacent_filtered_concept4.cpp
Normal file
40
test/compile_fail/adaptor/adjacent_filtered_concept4.cpp
Normal 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();
|
||||
}
|
24
test/compile_fail/adaptor/copied_concept.cpp
Normal file
24
test/compile_fail/adaptor/copied_concept.cpp
Normal 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();
|
||||
}
|
24
test/compile_fail/adaptor/copied_concept2.cpp
Normal file
24
test/compile_fail/adaptor/copied_concept2.cpp
Normal 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();
|
||||
}
|
23
test/compile_fail/adaptor/copied_concept3.cpp
Normal file
23
test/compile_fail/adaptor/copied_concept3.cpp
Normal 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();
|
||||
}
|
24
test/compile_fail/adaptor/copied_concept4.cpp
Normal file
24
test/compile_fail/adaptor/copied_concept4.cpp
Normal 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();
|
||||
}
|
38
test/compile_fail/adaptor/filtered_concept.cpp
Normal file
38
test/compile_fail/adaptor/filtered_concept.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
using boost::adaptors::filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return (mock_range<boost::single_pass_traversal_tag>() |
|
||||
filtered(always_true())).front();
|
||||
}
|
38
test/compile_fail/adaptor/filtered_concept2.cpp
Normal file
38
test/compile_fail/adaptor/filtered_concept2.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
using boost::adaptors::filtered;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return (mock_const_range<boost::single_pass_traversal_tag>() |
|
||||
filtered(always_true())).front();
|
||||
}
|
38
test/compile_fail/adaptor/filtered_concept3.cpp
Normal file
38
test/compile_fail/adaptor/filtered_concept3.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::filter(
|
||||
mock_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
38
test/compile_fail/adaptor/filtered_concept4.cpp
Normal file
38
test/compile_fail/adaptor/filtered_concept4.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
// Boost.Range library
|
||||
//
|
||||
// Copyright Neil Groves 2014. Use, modification and distribution is subject
|
||||
// to the Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// For more information, see http://www.boost.org/libs/range
|
||||
//
|
||||
|
||||
#include "mock_range.hpp"
|
||||
#include <boost/range/adaptor/filtered.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
struct always_true
|
||||
{
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(int) const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int main(int, const char**)
|
||||
{
|
||||
using boost::range::unit_test::mock_const_range;
|
||||
|
||||
// This next line should fail when Boost.Range concept checking is
|
||||
// enabled since the filtered adaptor takes at least a ForwardRange.
|
||||
return boost::adaptors::filter(
|
||||
mock_const_range<boost::single_pass_traversal_tag>(),
|
||||
always_true()).front();
|
||||
}
|
82
test/compile_fail/adaptor/mock_iterator.hpp
Normal file
82
test/compile_fail/adaptor/mock_iterator.hpp
Normal 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
|
50
test/compile_fail/adaptor/mock_range.hpp
Normal file
50
test/compile_fail/adaptor/mock_range.hpp
Normal 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
|
23
test/compile_fail/adaptor/reversed_concept.cpp
Normal file
23
test/compile_fail/adaptor/reversed_concept.cpp
Normal 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();
|
||||
}
|
||||
|
23
test/compile_fail/adaptor/reversed_concept2.cpp
Normal file
23
test/compile_fail/adaptor/reversed_concept2.cpp
Normal 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();
|
||||
}
|
||||
|
23
test/compile_fail/adaptor/reversed_concept3.cpp
Normal file
23
test/compile_fail/adaptor/reversed_concept3.cpp
Normal 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();
|
||||
}
|
||||
|
23
test/compile_fail/adaptor/reversed_concept4.cpp
Normal file
23
test/compile_fail/adaptor/reversed_concept4.cpp
Normal 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();
|
||||
}
|
||||
|
23
test/compile_fail/adaptor/sliced_concept.cpp
Normal file
23
test/compile_fail/adaptor/sliced_concept.cpp
Normal 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();
|
||||
}
|
23
test/compile_fail/adaptor/sliced_concept2.cpp
Normal file
23
test/compile_fail/adaptor/sliced_concept2.cpp
Normal 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();
|
||||
}
|
22
test/compile_fail/adaptor/sliced_concept3.cpp
Normal file
22
test/compile_fail/adaptor/sliced_concept3.cpp
Normal 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();
|
||||
}
|
22
test/compile_fail/adaptor/sliced_concept4.cpp
Normal file
22
test/compile_fail/adaptor/sliced_concept4.cpp
Normal 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();
|
||||
}
|
22
test/compile_fail/adaptor/uniqued_concept.cpp
Normal file
22
test/compile_fail/adaptor/uniqued_concept.cpp
Normal 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();
|
||||
}
|
23
test/compile_fail/adaptor/uniqued_concept2.cpp
Normal file
23
test/compile_fail/adaptor/uniqued_concept2.cpp
Normal 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();
|
||||
}
|
22
test/compile_fail/adaptor/uniqued_concept3.cpp
Normal file
22
test/compile_fail/adaptor/uniqued_concept3.cpp
Normal 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();
|
||||
}
|
22
test/compile_fail/adaptor/uniqued_concept4.cpp
Normal file
22
test/compile_fail/adaptor/uniqued_concept4.cpp
Normal 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();
|
||||
}
|
Reference in New Issue
Block a user