Skip to content

Request: Implement 'member-of-pointer' access operator (->) for Rfl types #684

Description

@Lazrius

Heya. I was wondering if it would be possible to implement the 'ptr' operator for many of the types to make accessing underlying data structures a bit easier and more in line with the STL.

I know that the dereference operator and the function '()' operator is already on a many of these, but I think that '->' would also be a very helpful one to have. It wont really help when you have many nested types, but I think (personally) it's a lot more intuitive to those unfamiliar with the library.

struct SpecialData
{
    std::string helloWorld = "hello world";
};

rfl::Skip<SpecialData> test{{}};

auto abc = test->helloWorld; // I think that this is more intuitive than the one below
auto dce = test().helloWorld;

Additionally, I think that it would map similar to the existing std::optional and rfl::Result types, which keeps things consistent 🙂

If you agree, I am more than happy to make the changes and put in a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions