-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
The below sample application fails to compile
#include <pybind11/pybind11.h>
namespace py = pybind11;
int main()
{
py::dict dict;
std::string value = "bar";
dict["foo"] = value;
return 0;
}
The error returned is:
main.cpp:40:14: error: no match for ‘operator=’ (operand types are \
‘pybind11::detail::item_accessor \
{aka pybind11::detail::accessor<pybind11::detail::accessor_policies::generic_item>}’ \
and ‘std::__cxx11::string \
{aka std::__cxx11::basic_string<char>}’)
dict["foo"] = value;
How does one store a string in a dict?
Metadata
Metadata
Assignees
Labels
No labels