Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

max_sizeof_list returns incorrect value for template types #358

Open
barycz opened this issue Jul 3, 2023 · 0 comments
Open

max_sizeof_list returns incorrect value for template types #358

barycz opened this issue Jul 3, 2023 · 0 comments

Comments

@barycz
Copy link

barycz commented Jul 3, 2023

In our project we wanted to extend variant_basic_types so variants could hold larger objects (like 4 component float vectors) without heap allocations. The problem we encountered is that adding template types to the type_list does not work. I am not sure if there is a bug in the compiler or the rttr code, but using Visual Studio 2022 I observe following behaviour:

// I am using std::string_view as an example, but other types declared as templates or typedefed templates trigger the bug too
#include <string_view>
using namespace rttr;
using type_list_with_string_view = detail::type_list<std::string_view>;
// following static_assert won't compile
static_assert(detail::max_sizeof_list<type_list_with_string_view>::value == sizeof(std::string_view), "should equal");

The value that compiler produces is 1, which makes me think this might be an compiler issue. The same thing happens if you add std::string view (and others) to the variant_basic_types, suddenly the max_sizeof_list::value produces 1. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant