Skip to content
Snippets Groups Projects
Commit a7d069c2 authored by Sam Yates's avatar Sam Yates
Browse files

Address code review on PR#77.

parent cc35b618
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ namespace nest {
namespace mc {
namespace util {
static struct nop_function_t {
struct nop_function_t {
template <typename R, typename... Args>
operator std::function<R (Args...)>() const {
return [](Args...) { return R{}; };
......@@ -22,7 +22,13 @@ static struct nop_function_t {
operator std::function<void (Args...)>() const {
return [](Args...) { };
}
} nop_function;
// keep clang happy: see CWG issue #253,
// http://open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#253
constexpr nop_function_t() {}
};
static constexpr nop_function_t nop_function;
} // namespace util
} // namespace mc
......
......@@ -3,7 +3,7 @@
using namespace nest::mc::util;
TEST(nop,void_fn) {
TEST(nop, void_fn) {
std::function<void ()> f{nop_function};
EXPECT_TRUE(f);
......@@ -42,7 +42,7 @@ struct check_default {
explicit check_default(int n): value(n) {}
};
TEST(nop,default_return_fn) {
TEST(nop, default_return_fn) {
std::function<check_default ()> f{nop_function};
EXPECT_TRUE(f);
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment