Skip to content

Conversation

@ITHelpDec
Copy link

@ITHelpDec ITHelpDec commented May 26, 2023

Consider changing line 23 from...

bucket_iterator find_entry_for(Key const& key) const

...to...
bucket_iterator find_entry_for(Key const& key)

Doesn't preserve const-ness, but fixes the following error, and allows for the code to run.

No viable conversion from returned value of type....
'std::__list_const_iterator<std::pair<int, int>, void *>'
...to function return type...
'ts::map<int, int>::bucket_type::bucket_iterator'
...(aka '__list_iterator<std::pair<int, int>, void *>')

Line 30...

Value value_for(Key const& key,Value const& default_value) const

...should then also be changed to...
Value value_for(Key const& key,Value const& default_value)

...to avoid the following compilation warning.

'this' argument to member function 'find_entry_for' has type...
`const ts::map<int, int>::bucket_type', ...
...but function is not marked const

- current function returns a mismatch of iterators (const vs non-const)

No viable conversion from returned value of type....
'std::__list_const_iterator<std::pair<int, int>, void *>'
...to function return type...
'ts::map<int, int>::bucket_type::bucket_iterator'
...(aka '__list_iterator<std::pair<int, int>, void *>')

- a better solution would be to preserve const-ness, but this will do for now
@ITHelpDec ITHelpDec mentioned this pull request May 26, 2023
- consider removing `const` to allow programme to compile

- 'this' argument to member function 'find_entry_for' has type...
- 'const ts::map<int, int>::bucket_type', ...
- ...but function is not marked const
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant