Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
amdis
amdis-core
Commits
4458a050
Commit
4458a050
authored
May 06, 2019
by
Praetorius, Simon
Browse files
add traits for testing whether something is a template or a type and add enable_if_all
parent
e01dcaf2
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/amdis/common/TypeTraits.hpp
View file @
4458a050
...
...
@@ -97,4 +97,29 @@ namespace AMDiS
return
std
::
make_unique
<
TYPEOF
(
obj
)
>
(
FWD
(
obj
));
}
template
<
template
<
class
...
>
class
>
constexpr
bool
is_template
()
{
return
true
;
}
#if AMDIS_HAS_CXX_AUTO_TEMPLATE_PARAMETER
template
<
template
<
class
,
auto
...>
class
>
constexpr
bool
is_template
()
{
return
true
;
}
#else
template
<
template
<
class
,
int
...>
class
>
constexpr
bool
is_template
()
{
return
true
;
}
template
<
template
<
class
,
std
::
size_t
...>
class
>
constexpr
bool
is_template
()
{
return
true
;
}
#endif
template
<
class
>
constexpr
bool
is_template
()
{
return
false
;
}
template
<
bool
...
b
>
using
enable_if_all_t
=
std
::
enable_if_t
<
std
::
is_same
<
std
::
integer_sequence
<
bool
,
true
,
b
...
>
,
std
::
integer_sequence
<
bool
,
b
...,
true
>>::
value
>
;
}
// end namespace AMDiS
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment