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

Template arguments range #167

Closed
disconnect3d opened this Issue Dec 1, 2015 · 3 comments

Comments

Projects
None yet
3 participants
@disconnect3d
Copy link
Contributor

disconnect3d commented Dec 1, 2015

Hello,

What do you think about adding a mechanism to iterate over range of template arguments passed to TEMPLATE_BENCHMARK?

Such thing could be implemented using loop template or Boost.Preprocessor (I guess we don't want to have any dependency on that).

I've added some insight on the topic on my blog post:
http://dominikczarnota.blogspot.com/2015/12/how-i-saved-myself-lot-of-writing-with.html

@dominichamon

This comment has been minimized.

Copy link
Member

dominichamon commented Dec 1, 2015

I think the work you've done is great for your use case, and I appreciate you documenting it so well.

I don't think there's any need to bring that into the library. If we did, we'd either bring in a dependency that I'd rather avoid, or add complexity to an API that is, frankly, already too complex for what it's doing.

@disconnect3d disconnect3d changed the title Iterate over template arguments Template arguments range Dec 1, 2015

@EricWF

This comment has been minimized.

Copy link
Contributor

EricWF commented Jul 21, 2016

I think #259 would allow you to easily right your own template range registration function.

For example:

template <class T> void BM_template(benchmark::State&) { /* ... */ }

void swallow(...);
template <class ...Types>
void BenchmarkTemplateRange() {
  swallow(benchmark::RegisterBenchmark(NAME(Types), &BM_template<Types>)...);
}
@EricWF

This comment has been minimized.

Copy link
Contributor

EricWF commented Aug 29, 2016

@disconnect3d I'm closing this because I think the solution I proposed allows you to do this already. Please reopen if you disagree.

@EricWF EricWF closed this Aug 29, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment