Skip to content

Commit d911d09

Browse files
committed
Fix compilation error on clang-8.0
1 parent 3ea8d06 commit d911d09

File tree

2 files changed

+32
-8
lines changed

2 files changed

+32
-8
lines changed

core/pythoncdb/py_properties.cc

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,20 +183,37 @@ namespace cadabra {
183183
return dynamic_cast<const PropT*>(BoundPropertyBase::prop);
184184
}
185185

186-
186+
template <typename PropT, typename... ParentTs>
187+
std::string BoundProperty<PropT, ParentTs...>::str_() const
188+
{
189+
return BoundPropertyBase::str_();
190+
}
191+
192+
template <typename PropT, typename... ParentTs>
193+
std::string BoundProperty<PropT, ParentTs...>::latex_() const
194+
{
195+
return BoundPropertyBase::latex_();
196+
}
197+
198+
template <typename PropT, typename... ParentTs>
199+
std::string BoundProperty<PropT, ParentTs...>::repr_() const
200+
{
201+
return BoundPropertyBase::str_();
202+
}
203+
187204
template <typename BoundPropT>
188205
typename BoundPropT::py_type def_abstract_prop(pybind11::module& m, const std::string& name)
189206
{
190207
using base_type = BoundPropT;
191-
using cpp_type = typename base_type::cpp_type;
208+
// using cpp_type = typename base_type::cpp_type;
192209
using py_type = typename base_type::py_type;
193210

194211
return py_type(m, name.c_str(), py::multiple_inheritance())
195212
.def_static("get", [](Ex_ptr ex, bool ipr) { return base_type::get_from_kernel(ex->begin(), ipr); }, py::arg("ex"), py::arg("ignore_parent_rel") = false)
196213
.def_static("get", [](ExNode node, bool ipr) { return base_type::get_from_kernel(node.it, ipr); }, py::arg("exnode"), py::arg("ignore_parent_rel") = false)
197-
.def("__str__", &base_type::str_)
198-
.def("__repr__", &base_type::repr_)
199-
.def("_latex_", &base_type::latex_);
214+
.def("__str__", &BoundPropT::str_)
215+
.def("__repr__", &BoundPropT::repr_)
216+
.def("_latex_", &BoundPropT::latex_);
200217
}
201218

202219
template <typename BoundPropT>
@@ -210,9 +227,9 @@ namespace cadabra {
210227
.def(py::init<Ex_ptr, Ex_ptr>(), py::arg("ex"), py::arg("param"))
211228
.def_static("get", [](Ex_ptr ex, bool ipr) { return base_type::get_from_kernel(ex->begin(), ipr); }, py::arg("ex"), py::arg("ignore_parent_rel") = false)
212229
.def_static("get", [](ExNode node, bool ipr) { return base_type::get_from_kernel(node.it, ipr); }, py::arg("exnode"), py::arg("ignore_parent_rel") = false)
213-
.def("__str__", &base_type::str_)
214-
.def("__repr__", &base_type::repr_)
215-
.def("_latex_", &base_type::latex_);
230+
.def("__str__", &BoundPropT::str_)
231+
.def("__repr__", &BoundPropT::repr_)
232+
.def("_latex_", &BoundPropT::latex_);
216233
}
217234

218235

core/pythoncdb/py_properties.hh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ namespace cadabra {
6060
// Construct from existing cpp property object
6161
BoundProperty(const PropT* prop, Ex_ptr for_obj);
6262

63+
/// Human-readable form in text, i.e. no special formatting.
64+
std::string str_() const;
65+
/// Human-readable form using LaTeX markup.
66+
std::string latex_() const;
67+
/// Python-parseable form. FIXME: not correct right now.
68+
std::string repr_() const;
69+
6370
// Get existing cpp property by querying kernel
6471
static std::shared_ptr<BoundProperty> get_from_kernel(Ex::iterator ex, bool ignore_parent_rel);
6572

0 commit comments

Comments
 (0)