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

How to register int[] property in a struct? #346

Open
Linhuihang opened this issue Sep 28, 2022 · 2 comments
Open

How to register int[] property in a struct? #346

Linhuihang opened this issue Sep 28, 2022 · 2 comments

Comments

@Linhuihang
Copy link

Linhuihang commented Sep 28, 2022

#include <rttr/registration>

struct MyStruct { MyStruct() {}; int data[3]; };

RTTR_REGISTRATION
{
    using namespace rttr;

    registration::class_<MyStruct>("MyStruct")
      .constructor<>()
      .property("data", &MyStruct::data);
}

int main() {
    return 0;
}

Compile error: error C2668: 'operator new[]': ambiguous call to overloaded function

@btgoodwin
Copy link

For one thing, your MyStruct needs RTTR_ENABLE(); in the declaration:

struct MyStruct {
  MyStruct() {}
  int data[3];

  RTTR_ENABLE();
};

@lyd405121
Copy link

  • I met the same error in visual studio 2022,Here is my solution:
  • Open project setting -> C/C++ ->Language->Comformance Mode(符合模式)->Default

burak-yildizoz added a commit to burak-yildizoz/rttr that referenced this issue Apr 25, 2024
See rttrorg#346 
Note that `std::is_bounded_array` is introduced in C++20.
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

3 participants