Skip to content

Commit bd60f04

Browse files
fix type_remap for strings (and python strings)
1 parent 0c5b742 commit bd60f04

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

clingwrapper/src/clingwrapper.cxx

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1602,12 +1602,12 @@ static inline std::string type_remap(const std::string& n1,
16021602
// since C++ does not have a operator+(std::string, std::wstring), we'll
16031603
// have to look up the same type and rely on the converters in
16041604
// CPyCppyy/_cppyy.
1605-
if (n1 == "str" || n1 == "unicode") {
1606-
// if (n2 ==
1607-
// "std::basic_string<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t>
1608-
// >")
1609-
// return n2; // match like for like
1610-
return "std::string"; // probably best bet
1605+
if (n1 == "str" || n1 == "unicode" || n1 == "std::basic_string<char>") {
1606+
if (n2 == "std::basic_string<wchar_t>")
1607+
return "std::basic_string<wchar_t>&"; // match like for like
1608+
return "std::basic_string<char>&"; // probably best bet
1609+
} else if (n1 == "std::basic_string<wchar_t>") {
1610+
return "std::basic_string<wchar_t>&";
16111611
} else if (n1 == "float") {
16121612
return "double"; // debatable, but probably intended
16131613
} else if (n1 == "complex") {
@@ -1678,11 +1678,10 @@ Cppyy::TCppMethod_t Cppyy::GetGlobalOperator(
16781678
Cpp::GetOperator(scope, Cpp::Operator::OP_Greater, overloads);
16791679
else if (opname == ">=")
16801680
Cpp::GetOperator(scope, Cpp::Operator::OP_GreaterEqual, overloads);
1681-
// FIXME: enabling `==` and `!=` requires friend operators
1682-
// else if (opname == "==")
1683-
// Cpp::GetOperator(scope, Cpp::Operator::OP_EqualEqual, overloads);
1684-
// else if (opname == "!=")
1685-
// Cpp::GetOperator(scope, Cpp::Operator::OP_ExclaimEqual, overloads);
1681+
else if (opname == "==")
1682+
Cpp::GetOperator(scope, Cpp::Operator::OP_EqualEqual, overloads);
1683+
else if (opname == "!=")
1684+
Cpp::GetOperator(scope, Cpp::Operator::OP_ExclaimEqual, overloads);
16861685
else if (opname == "<<")
16871686
Cpp::GetOperator(scope, Cpp::Operator::OP_LessLess, overloads);
16881687
else if (opname == ">>")

0 commit comments

Comments
 (0)