Skip to content

Template arguments range #167

Closed
Closed

Description

@disconnect3d

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

Activity

  1. dmah42 commented on Dec 1, 2015

    @dmah42
    Member

    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.

  2. changed the title [-]Iterate over template arguments[/-] [+]Template arguments range[/+] on Dec 1, 2015
  3. EricWF commented on Jul 21, 2016

    @EricWF
    Contributor

    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>)...);
    }
  4. EricWF commented on Aug 29, 2016

    @EricWF
    Contributor

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

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

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