diff options
Diffstat (limited to 'src')
| -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_ | 
