Skip to content

Better way to read value only if it exists? #104

@hoytech

Description

@hoytech

Hi! I'm frequently writing the following bit of code:

uint64_t limit = 10;
if (query.optional<uint64_t>("limit")) query.to(limit, "limit");

Is there a less verbose way? Maybe something like this:

uint64_t limit = 10;
query.to_if_exists(limit, "limit");

Thanks in advance for your advice!

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions