【Pybind11】:无法区别 const 和非 const 成员函数
/**
* @brief Get value in Loss with key.
*
* @return const std::map<std::string, LossCurve> & value in Loss at key.
* @warning The key must be exist in Loss. otherwise, the behavior is undefined and will cause segmentation fault.
*/
NO_DISCARD const LossCurve & get_loss(const std::string &key) const;
/**
* @brief Get mutable reference of value in Loss with key.
* A new key and default value will be created if the key does not exist.
*
* @return LossCurve& the mutable reference of value in Loss at key.
*/
LossCurve &get_loss(const std::string &key);
- 目前实现中,会被重复绑定。尚不清楚具体的表现。
Edited by chenyang.wang