Open bkietz opened 4 years ago
It's possible to implement a nameof<T>() which provides a string representation of T without requiring RTTI or demangling at runtime.
nameof<T>()
T
assert(nameof<r_string>() == "cpp11::r_string");
This might be helpful in a number of cases including providing better error messages from generics.
For in-the-wild use, see: https://github.com/apache/arrow/pull/8246/commits/87c26f7a7e5a393681057923a790f6448ea07817#diff-db94c392857c3bad4f5f69e86cde917bR164-R165
As a frequent user of the DEMANGLE macro from Rcpp, I would definitely welcome this.
DEMANGLE
Rcpp
https://gist.github.com/bkietz/7899f477e86df49f21ab17201c518d74
Do you want to work on a pull request @bkietz ?
Sure, I'll write one today
It's possible to implement a
nameof<T>()
which provides a string representation ofT
without requiring RTTI or demangling at runtime.This might be helpful in a number of cases including providing better error messages from generics.
For in-the-wild use, see: https://github.com/apache/arrow/pull/8246/commits/87c26f7a7e5a393681057923a790f6448ea07817#diff-db94c392857c3bad4f5f69e86cde917bR164-R165