Repository: google/benchmark
File: include/benchmark/benchmark.h (C/C++)

Code before:
    return false;
  }

 private:
  IterationCount cached_;
  State* const parent_;
};

inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
  return StateIterator(this);
}
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
  StartKeepRunning();
  return StateIterator();
}

// Base class for user-defined multi-threading
struct ThreadRunnerBase {
  virtual ~ThreadRunnerBase() {}
  virtual void RunThreads(const std::function<void(int)>& fn) = 0;
};

// Define alias of ThreadRunner factory function type
using threadrunner_factory =
    std::function<std::unique_ptr<ThreadRunnerBase>(int)>;

namespace internal {

typedef void(Function)(State&);

// ------------------------------------------------------
// Benchmark registration object.  The BENCHMARK() macro expands
// into an internal::Benchmark* object.  Various methods can
// be called on this object to change the properties of the benchmark.
// Each method returns "this" so that multiple method calls can
// chained into one expression.
class BENCHMARK_EXPORT Benchmark {
 public:
  virtual ~Benchmark();

  // Note: the following methods all return "this" so that multiple
  // method calls can be chained together in one expression.

  // Specify the name of the benchmark
  Benchmark* Name(const std::string& name);

  // Run this benchmark once with "x" as the extra argument passed
  // to the function.
  // REQUIRES: The function passed to the constructor must accept an arg1.
  Benchmark* Arg(int64_t x);


Review comment (suggestion):
do you intend this to be a type that is part of the public API?  if so, it should be `ThreadRunnerFactory` but i suspect it's just here to save typing, in which case we shouldn't have the alias here.

Code after:
    return false;
  }

 private:
  IterationCount cached_;
  State* const parent_;
};

inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::begin() {
  return StateIterator(this);
}
inline BENCHMARK_ALWAYS_INLINE State::StateIterator State::end() {
  StartKeepRunning();
  return StateIterator();
}

// Base class for user-defined multi-threading
struct ThreadRunnerBase {
  virtual ~ThreadRunnerBase() {}
  virtual void RunThreads(const std::function<void(int)>& fn) = 0;
};

namespace internal {

// Define alias of ThreadRunner factory function type
using threadrunner_factory =
    std::function<std::unique_ptr<ThreadRunnerBase>(int)>;

typedef void(Function)(State&);

// ------------------------------------------------------
// Benchmark registration object.  The BENCHMARK() macro expands
// into an internal::Benchmark* object.  Various methods can
// be called on this object to change the properties of the benchmark.
// Each method returns "this" so that multiple method calls can
// chained into one expression.
class BENCHMARK_EXPORT Benchmark {
 public:
  virtual ~Benchmark();

  // Note: the following methods all return "this" so that multiple
  // method calls can be chained together in one expression.

  // Specify the name of the benchmark
  Benchmark* Name(const std::string& name);

  // Run this benchmark once with "x" as the extra argument passed
  // to the function.
  // REQUIRES: The function passed to the constructor must accept an arg1.
  Benchmark* Arg(int64_t x);