diff options
author | Adrian Kummerlaender | 2015-02-06 19:40:55 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-06 19:40:55 +0100 |
commit | 32abf81176f654217c30f3a1dd25ba9ff4a67dc4 (patch) | |
tree | f04b90c72077e7726ab4fc8e9bfec9afe5465579 | |
parent | 27aaee43499c268903332c7e9e1e6ec2d193dc3a (diff) | |
download | TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar.gz TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar.bz2 TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar.lz TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar.xz TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.tar.zst TypeAsValue-32abf81176f654217c30f3a1dd25ba9ff4a67dc4.zip |
Moved _SFINAE_ helper into separate header
-rw-r--r-- | src/runtime/list/for_each.h | 7 | ||||
-rw-r--r-- | src/sfinae.h | 15 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/runtime/list/for_each.h b/src/runtime/list/for_each.h index 1ca2034..b7496a8 100644 --- a/src/runtime/list/for_each.h +++ b/src/runtime/list/for_each.h @@ -3,6 +3,7 @@ #include <type_traits> +#include "sfinae.h" #include "list/list.h" namespace tav { @@ -11,17 +12,17 @@ namespace runtime { template < typename Current, typename Function, - typename std::enable_if<std::is_void<Current>::value, std::size_t>::type = 0 + detail::enable_if<std::is_void<Current>::value> = 0 > void for_each(const Function&) { } template < typename Current, typename Function, - typename std::enable_if<!std::is_void<Current>::value, std::size_t>::type = 0 + detail::enable_if<!std::is_void<Current>::value> = 0 > void for_each(const Function& function) { - function(Head<Current>::type::value); + function(Head<Current>::value); for_each<Tail<Current>, Function>(function); } diff --git a/src/sfinae.h b/src/sfinae.h new file mode 100644 index 0000000..1f0cb74 --- /dev/null +++ b/src/sfinae.h @@ -0,0 +1,15 @@ +#ifndef TYPEASVALUE_SRC_SFINAE_H_ +#define TYPEASVALUE_SRC_SFINAE_H_ + +#include <type_traits> + +namespace tav { +namespace detail { + +template <bool Condition> +using enable_if = typename std::enable_if<Condition, std::size_t>::type; + +} +} + +#endif // TYPEASVALUE_SRC_SFINAE_H_ |