Skip to content

Commit

Permalink
Take review comments about _Arrow_proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
duanqn committed Aug 23, 2023
1 parent c2b32c0 commit 5bb5050
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions stl/inc/flat_map
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,31 @@ public:
using iterator_concept = random_access_iterator_tag;
using difference_type = ptrdiff_t;
using value_type = _STD pair<_STD iter_value_t<_Key_iterator_t>, _STD iter_value_t<_Mapped_iterator_t>>;
using reference =
_STD pair<_STD iter_const_reference_t<_Key_iterator_t>, _STD iter_reference_t<_Mapped_iterator_t>>;

private:
class _Arrow_Proxy
: public _STD
pair<_STD iter_const_reference_t<_Key_iterator_t>, _STD iter_reference_t<_Mapped_iterator_t>> {
class _Arrow_proxy {
public:
using _STD
pair<_STD iter_const_reference_t<_Key_iterator_t>, _STD iter_reference_t<_Mapped_iterator_t>>::pair;
_Arrow_Proxy* operator->() noexcept {
return this;
explicit _Arrow_proxy(const reference& _Rx) noexcept : _Ref{_Rx} {}

const reference* operator->() const noexcept {
return _STD addressof(_Ref);
}

private:
reference _Ref;
};

public:
using pointer = _Arrow_Proxy;
using reference =
_STD pair<_STD iter_const_reference_t<_Key_iterator_t>, _STD iter_reference_t<_Mapped_iterator_t>>;
using pointer = _Arrow_proxy;

reference operator*() const {
return reference{*_Key_it, *_Mapped_it};
}

pointer operator->() const {
return pointer{*_Key_it, *_Mapped_it};
return pointer{*(*this)};
}

type& operator++() {
Expand Down

0 comments on commit 5bb5050

Please sign in to comment.