Attampt to index refCounts with std::string when std::type_index is expected
@gpx1000 is already working on this.
Since Jun 1, 2026.
Assessment
This issue has not been assessed yet.
Description
Hi,
In the tutorial on Resource management (specifically here: https://docs.vulkan.org/tutorial/latest/Building_a_Simple_Engine/Engine_Architecture/04_resource_management.html#_resource_manager_storage_architecture_and_type_safety), an associative array is created to stored resources' reference counts based on a specific type. But I have a problem with the following section (https://docs.vulkan.org/tutorial/latest/Building_a_Simple_Engine/Engine_Architecture/04_resource_management.html#_resource_manager_resource_loading_and_caching_logic) in the Load method. In my understanding, when we try to increment/initialize the reference counter for a given resource, it does this :
refCounts[resourceId]++
or this :
refCounts[resourceId] = 1;
but based on the definition of the refCounts associative array, I would have thought it should have done something more like this :
auto& typeReferenceCounters = refCounts[std::type_index(typeid(T))];
typeReferenceCounters[resourceId].refCount++; // or typeReferenceCounters[resourceId].refCount = 1 for the other case
Please tell me if I am wrong, I would be glad to learn from my mistakes.
Best regards,
ajvp
- Dominant language
- C++
- Stars
- 424
- Forks
- 127
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from KhronosGroup/Vulkan-Tutorial
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
KhronosGroup/Vulkan-Tutorial#519 · 1 assignee ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
KhronosGroup/Vulkan-Tutorial#511 · 1 assignee ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
KhronosGroup/Vulkan-Tutorial#508 · 1 assignee ·
-
Difficulty 1/5 Under an hour Newbie friendliness 74/100
KhronosGroup/Vulkan-Tutorial#499 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
KhronosGroup/Vulkan-Tutorial#498 ·
All issues in KhronosGroup/Vulkan-Tutorial
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AXERA-TECH/ax-llm#77 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
games-on-whales/wolf#509 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
bug-unconfirmed
Difficulty 2/5 1-3 hours Newbie friendliness 76/100