File indexing completed on 2025-01-18 09:51:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_RANGE_JOIN_HPP_INCLUDED
0012 #define BOOST_RANGE_JOIN_HPP_INCLUDED
0013
0014 #include <boost/config.hpp>
0015 #include <boost/range/detail/join_iterator.hpp>
0016 #include <boost/range/concepts.hpp>
0017 #include <boost/range/iterator_range.hpp>
0018
0019 namespace boost
0020 {
0021 namespace range_detail
0022 {
0023
0024 template<class SinglePassRange1, class SinglePassRange2>
0025 class joined_type
0026 {
0027 public:
0028 typedef iterator_range<
0029 range_detail::join_iterator<
0030 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
0031 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type,
0032 BOOST_DEDUCED_TYPENAME range_value<SinglePassRange1>::type
0033 >
0034 > type;
0035 };
0036
0037 }
0038
0039 namespace range
0040 {
0041
0042 template<class SinglePassRange1, class SinglePassRange2>
0043 class joined_range
0044 : public range_detail::joined_type<SinglePassRange1, SinglePassRange2>::type
0045 {
0046 typedef range_detail::join_iterator<
0047 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type,
0048 BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange2>::type,
0049 BOOST_DEDUCED_TYPENAME range_value<SinglePassRange1>::type
0050 > iterator_t;
0051
0052 typedef BOOST_DEDUCED_TYPENAME range_detail::joined_type<
0053 SinglePassRange1, SinglePassRange2>::type base_t;
0054 public:
0055 joined_range(SinglePassRange1& rng1, SinglePassRange2& rng2)
0056 : base_t(
0057 iterator_t(rng1, rng2, range_detail::join_iterator_begin_tag()),
0058 iterator_t(rng1, rng2, range_detail::join_iterator_end_tag())
0059 )
0060 {
0061 }
0062 };
0063
0064 template<class SinglePassRange1, class SinglePassRange2>
0065 joined_range<const SinglePassRange1, const SinglePassRange2>
0066 join(const SinglePassRange1& r1, const SinglePassRange2& r2)
0067 {
0068 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
0069 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
0070
0071 return joined_range<const SinglePassRange1, const SinglePassRange2>(r1, r2);
0072 }
0073
0074 template<class SinglePassRange1, class SinglePassRange2>
0075 joined_range<SinglePassRange1, SinglePassRange2>
0076 join(SinglePassRange1& r1, SinglePassRange2& r2)
0077 {
0078 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
0079 BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange2> ));
0080
0081 return joined_range<SinglePassRange1, SinglePassRange2>(r1, r2);
0082 }
0083
0084 }
0085
0086 using ::boost::range::joined_range;
0087 using ::boost::range::join;
0088
0089 }
0090
0091 #endif