Skip to content

Commit

Permalink
Remove Clif_PyObjFrom for std::string.
Browse files Browse the repository at this point in the history
`std::string` is implicitly convertible to `std::string_view`. So it is safe to only keep the `Clif_PyObjFrom` conversion function for `std::string_view`.

PiperOrigin-RevId: 406464119
  • Loading branch information
wangxf authored and wangxf123456 committed Oct 29, 2021
1 parent f349e2a commit ef5fa11
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
4 changes: 0 additions & 4 deletions clif/python/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ namespace clif {
//// To Python conversions.

// bytes
PyObject* Clif_PyObjFrom(const std::string& c, const py::PostConv& pc) {
return pc.Apply(PyBytes_FromStringAndSize(c.data(), c.size()));
}

PyObject* Clif_PyObjFrom(std::string_view c, const py::PostConv& pc) {
return pc.Apply(PyBytes_FromStringAndSize(c.data(), c.size()));
}
Expand Down
1 change: 0 additions & 1 deletion clif/python/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ inline PyObject* Clif_PyObjFrom(T c, const py::PostConv& pc) {
return pc.Apply(PyBool_FromLong(c));
}

PyObject* Clif_PyObjFrom(const std::string&, const py::PostConv&);
PyObject* Clif_PyObjFrom(std::string_view, const py::PostConv&);
// CLIF use `::std::string` as bytes

Expand Down

0 comments on commit ef5fa11

Please sign in to comment.