Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arbor-sim
arbor
Commits
a7d069c2
Commit
a7d069c2
authored
8 years ago
by
Sam Yates
Browse files
Options
Downloads
Patches
Plain Diff
Address code review on PR#77.
parent
cc35b618
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/util/nop.hpp
+8
-2
8 additions, 2 deletions
src/util/nop.hpp
tests/unit/test_nop.cpp
+2
-2
2 additions, 2 deletions
tests/unit/test_nop.cpp
with
10 additions
and
4 deletions
src/util/nop.hpp
+
8
−
2
View file @
a7d069c2
...
@@ -12,7 +12,7 @@ namespace nest {
...
@@ -12,7 +12,7 @@ namespace nest {
namespace
mc
{
namespace
mc
{
namespace
util
{
namespace
util
{
static
struct
nop_function_t
{
struct
nop_function_t
{
template
<
typename
R
,
typename
...
Args
>
template
<
typename
R
,
typename
...
Args
>
operator
std
::
function
<
R
(
Args
...)
>
()
const
{
operator
std
::
function
<
R
(
Args
...)
>
()
const
{
return
[](
Args
...)
{
return
R
{};
};
return
[](
Args
...)
{
return
R
{};
};
...
@@ -22,7 +22,13 @@ static struct nop_function_t {
...
@@ -22,7 +22,13 @@ static struct nop_function_t {
operator
std
::
function
<
void
(
Args
...)
>
()
const
{
operator
std
::
function
<
void
(
Args
...)
>
()
const
{
return
[](
Args
...)
{
};
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 util
}
// namespace mc
}
// namespace mc
...
...
This diff is collapsed.
Click to expand it.
tests/unit/test_nop.cpp
+
2
−
2
View file @
a7d069c2
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
using
namespace
nest
::
mc
::
util
;
using
namespace
nest
::
mc
::
util
;
TEST
(
nop
,
void_fn
)
{
TEST
(
nop
,
void_fn
)
{
std
::
function
<
void
()
>
f
{
nop_function
};
std
::
function
<
void
()
>
f
{
nop_function
};
EXPECT_TRUE
(
f
);
EXPECT_TRUE
(
f
);
...
@@ -42,7 +42,7 @@ struct check_default {
...
@@ -42,7 +42,7 @@ struct check_default {
explicit
check_default
(
int
n
)
:
value
(
n
)
{}
explicit
check_default
(
int
n
)
:
value
(
n
)
{}
};
};
TEST
(
nop
,
default_return_fn
)
{
TEST
(
nop
,
default_return_fn
)
{
std
::
function
<
check_default
()
>
f
{
nop_function
};
std
::
function
<
check_default
()
>
f
{
nop_function
};
EXPECT_TRUE
(
f
);
EXPECT_TRUE
(
f
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment