File indexing completed on 2025-01-18 09:47:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef BOOST_POLY_COLLECTION_DETAIL_ITERATOR_TRAITS_HPP
0010 #define BOOST_POLY_COLLECTION_DETAIL_ITERATOR_TRAITS_HPP
0011
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015
0016 #include <iterator>
0017 #include <type_traits>
0018
0019 namespace boost{
0020
0021 namespace poly_collection{
0022
0023 namespace common_impl{
0024
0025 template<typename Model,typename Allocator>
0026 class poly_collection;
0027
0028 }
0029
0030 namespace detail{
0031
0032
0033
0034
0035
0036
0037 template<typename Iterator>
0038 struct poly_collection_of
0039 {
0040 using type=void;
0041 };
0042
0043 template<typename PolyCollection>
0044 struct model_of;
0045
0046 template<typename Model,typename Allocator>
0047 struct model_of<common_impl::poly_collection<Model,Allocator>>
0048 {
0049 using type=Model;
0050 };
0051
0052 template<typename Iterator>
0053 struct iterator_traits
0054 {
0055 using container_type=typename poly_collection_of<Iterator>::type;
0056 using is_const_iterator=typename std::is_const<
0057 typename std::remove_reference<
0058 typename std::iterator_traits<Iterator>::reference
0059 >::type
0060 >::type;
0061 using iterator=typename std::conditional<
0062 is_const_iterator::value,
0063 typename container_type::const_iterator,
0064 typename container_type::iterator
0065 >::type;
0066 using base_segment_info_iterator=typename std::conditional<
0067 is_const_iterator::value,
0068 typename container_type::const_base_segment_info_iterator,
0069 typename container_type::base_segment_info_iterator
0070 >::type;
0071 using local_base_iterator=typename std::conditional<
0072 is_const_iterator::value,
0073 typename container_type::const_local_base_iterator,
0074 typename container_type::local_base_iterator
0075 >::type;
0076 template<typename T>
0077 using local_iterator=typename std::conditional<
0078 is_const_iterator::value,
0079 typename container_type::template const_local_iterator<T>,
0080 typename container_type::template local_iterator<T>
0081 >::type;
0082
0083 static base_segment_info_iterator
0084 base_segment_info_iterator_from(iterator it)noexcept{return it.mapit;}
0085
0086 static base_segment_info_iterator
0087 base_segment_info_iterator_from(local_base_iterator it)noexcept
0088 {return it.mapit;}
0089
0090 static base_segment_info_iterator
0091 end_base_segment_info_iterator_from(iterator it)noexcept{return it.mapend;}
0092
0093 static local_base_iterator
0094 local_base_iterator_from(iterator it)noexcept
0095 {
0096 return {
0097 it.mapit,
0098 model_of<container_type>::type::nonconst_iterator(it.segpos)
0099 };
0100 }
0101
0102 static iterator
0103 iterator_from(
0104 local_base_iterator lbit,base_segment_info_iterator mapend)noexcept
0105 {
0106 return {lbit.mapit,mapend.base(),lbit.base()};
0107 }
0108 };
0109
0110 }
0111
0112 }
0113
0114 }
0115
0116 #endif