Skip to content

add const access#20

Open
ahgamut wants to merge 1 commit intojart:mainfrom
ahgamut:const-access
Open

add const access#20
ahgamut wants to merge 1 commit intojart:mainfrom
ahgamut:const-access

Conversation

@ahgamut
Copy link
Copy Markdown

@ahgamut ahgamut commented Apr 6, 2026

It's not really necessary, but would be nice to have. The use case for me is the JSON object being part of a struct, and I have a bunch of const methods for the outer struct.

class Foo {
   jt::Json info;

   public:
        double getObj1A() { return info["obj1"].getNumber(); } // works
        double getObj1B() const { return info["obj1"].getNumber(); } // should work with this PR
        const std::vector<jt::Json>& getObj2() const { 
            return info["obj2"].getArray(); // should work with this PR
        }
}

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

Successfully merging this pull request may close these issues.

1 participant