Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ using namespace Rcpp;
static std::string demangler_one(const char* input) {
static std::string buffer;
buffer = input;
buffer.resize(buffer.find_last_of('+') - 1);
buffer.erase(
buffer.begin(),
buffer.begin() + buffer.find_last_of(' ') + 1
);
const auto last_plus = buffer.find_last_of('+');
if (last_plus != std::string::npos) {
buffer.resize(last_plus - 1);
}
const auto last_space = buffer.find_last_of(' ');
if (last_space != std::string::npos) {
buffer.erase(buffer.begin(), buffer.begin() + last_space + 1);
}
return demangle(buffer);
}

Expand Down