Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lihuiba committed Apr 22, 2024
1 parent 2d4d715 commit 950481d
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions common/string-keyed.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ class basic_map_string_kv : public M
mutable bool _has_val = false;

iterator(base_it b_it) : _b_it(b_it) { }
iterator(typename base::const_iterator b_it) {
auto x = (B_IT*) &b_it;
_b_it = *x;
}

mutable_value_type& _init_val() const {
if (_has_val) return _val;
Expand Down Expand Up @@ -324,8 +328,7 @@ class basic_map_string_kv : public M
using B_IT = typename base::iterator;
const_iterator end() const
{
auto it = base::end();
return reinterpret_cast<B_IT&>(it);
return {base::end()};
}
iterator end()
{
Expand Down Expand Up @@ -353,23 +356,19 @@ class basic_map_string_kv : public M
}
const_iterator find ( const key_type& k ) const
{
auto it = base::find((const skvm&)k);
return reinterpret_cast<B_IT&>(it);
return {base::find((const skvm&)k)};
}
iterator find ( const key_type& k )
{
auto it = base::find((const skvm&)k);
return (B_IT&)it;
return {base::find((const skvm&)k)};
}
size_type count ( const key_type& k ) const
{
return base::count((const skvm&)k);
}
std::pair<const_iterator,const_iterator> equal_range ( const key_type& k ) const
{
auto r = base::equal_range((const skvm&)k);
return {reinterpret_cast<B_IT&>(r.first),
reinterpret_cast<B_IT&>(r.second)};
return {base::equal_range((const skvm&)k)};
}
std::pair<iterator, bool> emplace (const key_type& k, const mapped_type& v )
{
Expand Down

0 comments on commit 950481d

Please sign in to comment.