Skip to content

Commit a9fb6aa

Browse files
committed
Avoid instantiating vector::begin() when declaring flat_map
Otherwise, this prevents us from being able to declare a flat_map containing an incomplete type.
1 parent a2cd12c commit a9fb6aa

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

libcxx/include/__flat_map/key_value_iterator.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
#include <__config>
1616
#include <__iterator/iterator_traits.h>
1717
#include <__memory/addressof.h>
18-
#include <__ranges/access.h>
1918
#include <__type_traits/conditional.h>
20-
#include <__type_traits/maybe_const.h>
2119
#include <__utility/move.h>
2220
#include <__utility/pair.h>
2321

@@ -41,9 +39,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
4139
template <class _Owner, class _KeyContainer, class _MappedContainer, bool _Const>
4240
struct __key_value_iterator {
4341
private:
44-
using __key_iterator _LIBCPP_NODEBUG = ranges::iterator_t<const _KeyContainer>;
45-
using __mapped_iterator _LIBCPP_NODEBUG = ranges::iterator_t<__maybe_const<_Const, _MappedContainer>>;
46-
using __reference _LIBCPP_NODEBUG = _If<_Const, typename _Owner::const_reference, typename _Owner::reference>;
42+
using __key_iterator _LIBCPP_NODEBUG = typename _KeyContainer::const_iterator;
43+
using __mapped_iterator _LIBCPP_NODEBUG =
44+
_If<_Const, typename _MappedContainer::const_iterator, typename _MappedContainer::iterator>;
45+
using __reference _LIBCPP_NODEBUG = _If<_Const, typename _Owner::const_reference, typename _Owner::reference>;
4746

4847
struct __arrow_proxy {
4948
__reference __ref_;
@@ -71,8 +70,8 @@ struct __key_value_iterator {
7170
_LIBCPP_HIDE_FROM_ABI __key_value_iterator() = default;
7271

7372
_LIBCPP_HIDE_FROM_ABI __key_value_iterator(__key_value_iterator<_Owner, _KeyContainer, _MappedContainer, !_Const> __i)
74-
requires _Const && convertible_to<ranges::iterator_t<_KeyContainer>, __key_iterator> &&
75-
convertible_to<ranges::iterator_t<_MappedContainer>, __mapped_iterator>
73+
requires _Const && convertible_to<typename _KeyContainer::iterator, __key_iterator> &&
74+
convertible_to<typename _MappedContainer::iterator, __mapped_iterator>
7675
: __key_iter_(std::move(__i.__key_iter_)), __mapped_iter_(std::move(__i.__mapped_iter_)) {}
7776

7877
_LIBCPP_HIDE_FROM_ABI __key_value_iterator(__key_iterator __key_iter, __mapped_iterator __mapped_iter)

0 commit comments

Comments
 (0)