-
-
Save anonymous/1fb8824bc81d0a51b5ff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
inline std::vector<benchmark>& benchmark_registry() { | |
static std::vector<benchmark> registry; | |
return registry; | |
} | |
struct benchmark_registrar { | |
template <typename Fun> | |
benchmark_registrar(std::string name, Fun&& registrant) { | |
benchmark_registry().emplace_back(std::move(name), std::forward<Fun>(registrant)); | |
} | |
}; | |
} // namespace nonius | |
#define NONIUS_BENCHMARK(name, ...) \ | |
namespace { static ::nonius::benchmark_registrar NONIUS_DETAIL_UNIQUE_NAME(benchmark_registrar) (name, __VA_ARGS__); } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
inline std::vector<benchmark>& benchmark_registry() { | |
static std::vector<benchmark> registry; | |
return registry; | |
} | |
struct benchmark_registrar { | |
template <typename Fun> | |
benchmark_registrar(std::vector<benchmark>& registry, std::string name, Fun&& registrant) { | |
registry.emplace_back(std::move(name), std::forward<Fun>(registrant)); | |
} | |
}; | |
} // namespace nonius | |
#define NONIUS_BENCHMARK(name, ...) \ | |
namespace { static ::nonius::benchmark_registrar NONIUS_DETAIL_UNIQUE_NAME(benchmark_registrar) (::nonius::benchmark_registry(), name, __VA_ARGS__); } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment