diff options
author | Adrian Kummerlaender | 2015-02-22 17:14:15 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-22 17:14:15 +0100 |
commit | 41b63eff7f76e6574ef238f821dad0212a619c2a (patch) | |
tree | 291652f853e32c80183fd1178d470c5499eee1c5 /src | |
parent | 18fe83991563c0072fabaa60ff161e781a5364c2 (diff) | |
download | TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar.gz TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar.bz2 TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar.lz TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar.xz TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.tar.zst TypeAsValue-41b63eff7f76e6574ef238f821dad0212a619c2a.zip |
Improved `simulate` function of the Turing machine example
* introduced `state::state_accessor` helper function and moved position logic into `updatePosition`
* added `IsEqual` comparator and expressed other basic comparators in terms of itself
Diffstat (limited to 'src')
-rw-r--r-- | src/list/list.h | 8 | ||||
-rw-r--r-- | src/type.h | 16 |
2 files changed, 15 insertions, 9 deletions
diff --git a/src/list/list.h b/src/list/list.h index cf4f415..c23362a 100644 --- a/src/list/list.h +++ b/src/list/list.h @@ -18,11 +18,11 @@ using ListOfType = List< std::integral_constant<Type, Values>... >; -template <typename Cons> -using Head = Car<Cons>; +template <typename Pair> +using Head = Car<Pair>; -template <typename Cons> -using Tail = Cdr<Cons>; +template <typename Pair> +using Tail = Cdr<Pair>; } @@ -24,10 +24,16 @@ template < typename X, typename Y > -using IsEqualType = Eval<std::is_same< +using IsEqual = Eval<std::is_same<X, Y>>; + +template < + typename X, + typename Y +> +using IsEqualType = IsEqual< typename X::value_type, typename Y::value_type ->>; +>; template < typename X, @@ -36,13 +42,13 @@ template < using IsEqualValue = Boolean<X::value == Y::value>; template <typename X> -using IsTrue = IsEqualValue<X, Boolean<true>>; +using IsBoolean = IsEqual<typename X::value_type, bool>; template <typename X> -using IsBoolean = Eval<std::is_same<typename X::value_type, bool>>; +using IsTrue = IsEqualValue<X, Boolean<true>>; template <typename X> -using IsSize = Eval<std::is_same<typename X::value_type, std::size_t>>; +using IsSize = IsEqual<typename X::value_type, std::size_t>; } |