Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

map_indexing_suite doesn't work with std::unordered_map<std::string, std::vector<double>> for MSVC 14.2

Open
#289 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
38/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp, python
Domain
api

Research direction

Start in boost/python/suite/indexing/map_indexing_suite.hpp at line 155 and reproduce the build with MSVC v142 using the nested std::unordered_map example. Compare it with the std::map and string-value cases described in the report. Done means the map_indexing_suite example builds successfully with the nested unordered_map configuration.

Written by the indexing model from the issue text.

Description

This works on MSVC 14.1 (Visual Studio 17):

#define BOOST_PYTHON_STATIC_LIB

#include <boost/python.hpp>
#include <boost/python/suite/indexing/map_indexing_suite.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <string>
#include <unordered_map>
#include <vector>

BOOST_PYTHON_MODULE(HelloBoostPython)
{
    using namespace boost::python;

    class_<std::vector<double>>("DoubleVector")
        .def(vector_indexing_suite<std::vector<double>>())
        ;

    class_<std::unordered_map<std::string, std::string>>("StringVecMap")
        .def(map_indexing_suite<std::unordered_map<std::string, std::vector<double>>>())
        ;
}

But fails when building against the v142 (VS 19) Platform Toolset:

Severity	Code	Description	Project	File	Line	Suppression State
Error	C2039	'key_comp': is not a member of 'std::unordered_map<std::string,std::vector<double,std::allocator<double>>,std::hash<std::string>,std::equal_to<std::string>,std::allocator<std::pair<const std::string,std::vector<double,std::allocator<double>>>>>'	HelloBoostPython	C:\Misc\boost_1_71_0\boost\python\suite\indexing\map_indexing_suite.hpp	155	

Change std::unordered_map to std::map and it works.

Change std::unordered_map<std::string, std::vector<double>> to std::unordered_map<std::string, std::string>> and it works.

Dominant language
C++
Stars
537
Forks
223
Avg merge
11h 22m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/python

All issues in boostorg/python

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.