Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#289 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
cpp, python
領域
api

調査の方向性

boost/python/suite/indexing/map_indexing_suite.hpp の 155 行目から開始し、ネストされた std::unordered_map の例を使用して MSVC v142 でビルドを再現します。レポートに記載されている std::map のケースおよび string 値のケースと比較してください。ネストされた unordered_map 構成で map_indexing_suite の例が正常にビルドできれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
C++
スター
537
フォーク
223
平均マージ
11時間 22分
マージ済み PR(30日)
2

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

boostorg/python のほかの issue

boostorg/python の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。