Commit a0059d78 authored by Dominik Charousset's avatar Dominik Charousset

fixed handling of 'const' in `to_uniform_name`

parent 40b92b4c
...@@ -94,7 +94,13 @@ constexpr const char* mapped_name() { ...@@ -94,7 +94,13 @@ constexpr const char* mapped_name() {
return mapped_type_names[util::tl_index_of<zipped_type_list, T>::value][1]; return mapped_type_names[util::tl_index_of<zipped_type_list, T>::value][1];
} }
const char* mapped_name_by_decorated_name(const char* decorated_type_name); const char* mapped_name_by_decorated_name(const char* decorated_name);
std::string mapped_name_by_decorated_name(std::string&& decorated_name);
inline const char* mapped_name_by_decorated_name(const std::string& decorated_name) {
return mapped_name_by_decorated_name(decorated_name.c_str());
}
// lookup table for integer types // lookup table for integer types
extern const char* mapped_int_names[][2]; extern const char* mapped_int_names[][2];
......
This diff is collapsed.
...@@ -123,6 +123,11 @@ const char* mapped_name_by_decorated_name(const char* cstr) { ...@@ -123,6 +123,11 @@ const char* mapped_name_by_decorated_name(const char* cstr) {
return cstr; return cstr;
} }
std::string mapped_name_by_decorated_name(std::string&& str) {
auto res = mapped_name_by_decorated_name(str.c_str());
if (res == str.c_str()) return std::move(str);
return res;
}
namespace { namespace {
......
...@@ -64,6 +64,11 @@ int main() { ...@@ -64,6 +64,11 @@ int main() {
CPPA_CHECK_EQUAL(get<foo>(obj1).value, 42); CPPA_CHECK_EQUAL(get<foo>(obj1).value, 42);
CPPA_CHECK_EQUAL(get<foo>(obj2).value, 0); CPPA_CHECK_EQUAL(get<foo>(obj2).value, 0);
} }
{
auto uti = uniform_typeid<atom_value>();
CPPA_CHECK(uti != nullptr);
CPPA_CHECK_EQUAL(uti->name(), "@atom");
}
// these types (and only those) are present if // these types (and only those) are present if
// the uniform_type_info implementation is correct // the uniform_type_info implementation is correct
std::set<std::string> expected = { std::set<std::string> expected = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment