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

[Feature Request] Mutable Benchmark Results #105

Open
c0nstexpr opened this issue Jan 17, 2024 · 0 comments
Open

[Feature Request] Mutable Benchmark Results #105

c0nstexpr opened this issue Jan 17, 2024 · 0 comments

Comments

@c0nstexpr
Copy link

c0nstexpr commented Jan 17, 2024

Currently Result doesn't have any mutable method, which makes it hard to add custom variable or modify.
For example we have a relative(true) benchmark result and we would like to add the relative performance result. One may want to add it by setting the context varible, but find out context method is const.

ANKERL_NANOBENCH(NODISCARD) std::string const& Result::context(char const* variableName) const;
ANKERL_NANOBENCH(NODISCARD) std::string const& Result::context(std::string const& variableName) const;

A possible solution would be copy the result and use const_cast:
auto& context = const_cast<string&>(result.context("myVar"));
But I don't think anyone would totally accept to use that cast in such situation.

@c0nstexpr c0nstexpr changed the title [Feature Request] Editable Benchmark Results [Feature Request] Mutable Benchmark Results Jan 18, 2024
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