Ignore:
Timestamp:
2018-07-05T21:41:21Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
86d1939
Parents:
b044f66
git-author:
Dzejrou <dzejrou@…> (2018-04-24 21:12:20)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:21)
Message:

cpp: fixed semantic errors, added support functions for higher level containers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/internal/hash_table.hpp

    rb044f66 r86b3ae98  
    5353    struct key_value_key_extractor
    5454    {
    55         Key& operator()(pair<Key, Value>& p) const noexcept
    56         {
    57             return p.first;
    58         }
    59 
    60         const Key& operator()(pair<const Key, Value>& p) const noexcept
     55        const Key& operator()(const pair<const Key, Value>& p) const noexcept
    6156        {
    6257            return p.first;
     
    201196        {
    202197            auto it = table.find(key);
    203             return make_pair(it, it);
     198            return make_pair(it, ++it);
    204199        }
    205200
     
    211206        { // Note: We cannot overload by return type, so we use a different name.
    212207            auto it = table.find(key);
    213             return make_pair(it, it);
     208            return make_pair(it, ++it);
    214209        }
    215210    };
     
    705700            using const_local_iterator = ConstLocalIterator;
    706701
     702            using node_type = list_node<value_type>;
     703
    707704            using hint_type = tuple<
    708705                hash_table_bucket<value_type, size_type>*,
     
    11021099            }
    11031100
    1104             hasher hash_function() const
    1105             {
    1106                 return hasher_;
    1107             }
    1108 
    1109             key_equal key_eq() const
    1110             {
    1111                 return key_eq_;
    1112             }
    1113 
    1114         /* private: */
     1101            bool keys_equal(const key_type& key, const value_type& val)
     1102            {
     1103                return key_eq_(key, key_extractor_(val));
     1104            }
     1105
     1106            hash_table_bucket<value_type, size_type>* table()
     1107            {
     1108                return table_;
     1109            }
     1110
     1111            hash_table_bucket<value_type, size_type>* head(size_type idx)
     1112            {
     1113                if (idx < bucket_count_)
     1114                    return &table_[idx];
     1115                else
     1116                    return nullptr;
     1117            }
     1118
     1119        private:
    11151120            hash_table_bucket<value_type, size_type>* table_;
    11161121            size_type bucket_count_;
Note: See TracChangeset for help on using the changeset viewer.