MCPcopy Create free account
hub / github.com/pybind/pybind11 / value

Function value

include/pybind11/pybind11.h:3101–3112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3099 }
3100
3101 PYBIND11_NOINLINE void value(char const *name_, object value, const char *doc = nullptr) {
3102 dict entries = m_base.attr("__entries");
3103 str name(name_);
3104 if (entries.contains(name)) {
3105 std::string type_name = std::string(str(m_base.attr("__name__")));
3106 throw value_error(std::move(type_name) + ": element \"" + std::string(name_)
3107 + "\" already exists!");
3108 }
3109
3110 entries[name] = pybind11::make_tuple(value, doc);
3111 m_base.attr(std::move(name)) = std::move(value);
3112 }
3113
3114 PYBIND11_NOINLINE void export_values() {
3115 dict entries = m_base.attr("__entries");

Callers 3

operator->Method · 0.85
valueMethod · 0.85

Calls 5

strClass · 0.85
moveFunction · 0.85
make_tupleFunction · 0.85
attrMethod · 0.80
containsMethod · 0.45

Tested by 1

operator->Method · 0.68