boostorg / boostorg/compute

Unwanted function call for std::map::operator[]

Open
#866 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
C++
Stars
1.7k
Forks
340
PR merge metrics
No merged PRs in 30d

Description

https://github.com/boostorg/compute/blob/36c89134d4013b2e5e45bc55656a18bd6141995a/include/boost/compute/detail/lru_cache.hpp#L102

Since i is a valid iterator, we can replace this call with.
**m_map[key]** = std::make_pair(value, j);

with

**i->second** = std::make_pair(value, j);

avoiding the second map search.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.