diff options
author | Adrian Kummerlaender | 2015-02-19 19:37:51 +0100 |
---|---|---|
committer | Adrian Kummerlaender | 2015-02-19 19:37:51 +0100 |
commit | b1d5bf3aed57f38958fa6757b036d75d01217d18 (patch) | |
tree | 5c98ebeb013318b27d9e2c888202f8fd7fd5ab20 /pages | |
parent | 376c524f965674de8649267bad20937d6c0f9cd9 (diff) | |
download | blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar.gz blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar.bz2 blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar.lz blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar.xz blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.tar.zst blog_content-b1d5bf3aed57f38958fa6757b036d75d01217d18.zip |
Updated _TypeAsValue_ and _ConstList_ project pages
Diffstat (limited to 'pages')
-rw-r--r-- | pages/projects/const_list.md | 3 | ||||
-rw-r--r-- | pages/projects/type_as_value.md | 32 |
2 files changed, 23 insertions, 12 deletions
diff --git a/pages/projects/const_list.md b/pages/projects/const_list.md index 09aa036..9a5c18c 100644 --- a/pages/projects/const_list.md +++ b/pages/projects/const_list.md @@ -6,6 +6,8 @@ The MIT licensed implementation may be found on [Github] or [cgit]. It was written as a experiment in how far one could take the optional compile-time executability offered by `constexpr` specifically and the C++ template metaprogramming facilities in general. While basic _Cons_ structures and appropriate accessor functions turned out to be quite straight forward to implement, the current problem is the absence of workable arbitrary value comparison in a templated context if one doesn't want to be limited to values that can be used as template parameters such as integers. This means that it is currently impossible to e.g. filter a list using `foldr`. +Note that these restrictions were overcome in my [second attempt] at this problem which follows the concept of viewing types as values and templates as functions. + ## Current features - `Cons` class template for representing constant list structures at compile time @@ -35,3 +37,4 @@ const int sum{ [Github]: https://github.com/KnairdA/ConstList/ [cgit]: http://code.kummerlaender.eu/ConstList/ +[second attempt]: /page/type_as_value/ diff --git a/pages/projects/type_as_value.md b/pages/projects/type_as_value.md index e8d2a21..839e691 100644 --- a/pages/projects/type_as_value.md +++ b/pages/projects/type_as_value.md @@ -2,9 +2,9 @@ …is a template metaprogramming library intended for compile time computation written in C++. -As its name implies it follows the overall concept of viewing types as values and templates as functions manipulating those values. This view on template metaprogramming lends itself quite well to a _Scheme_ like way of doing functional programming. +As its name implies it follows the overall concept of viewing types as values and templates as functions manipulating those values. -_TypeAsValue_ is currently primarily a reimplementation of my previous attempt at this problem: [ConstList]. As detailed in the appropriate [blog article] the mixed approach between generic lambda expressions, `constexpr` marked functions and template metaprogramming doesn't offer sufficient flexibility which led me to approach compile time computation in a slightly different manner via this new library. +This library is a expanded reimplementation of my previous attempt at this problem: [ConstList]. As detailed in the appropriate [blog article] the mixed approach between generic lambda expressions, `constexpr` marked functions and template metaprogramming doesn't offer sufficient flexibility which led me to approach compile time computation in a slightly different manner via this new library. As one might notice this boils down to using _Scheme_ as a metaphor for C++ template metaprogramming. In fact all [test cases] and examples are documented by representing their logic in _Scheme_. Its MIT licensed source code is available on both [Github] and [cgit]. @@ -12,15 +12,19 @@ Its MIT licensed source code is available on both [Github] and [cgit]. * guaranteed evaluation during compile time * basic math and logic operations -* conditionals -* `Cons` structure -* `List` function as helper for `Cons` construction +* conditionals such as `If` and `Cond` +* `Cons` constructor for `Pair` type +* `List` function as helper for `Pair` based list construction * basic list operators such as `Nth`, `Length`, `Take` and `Append` +* list generators such as `Iota` and `MakeList` * higher order list operation `Fold` * higher order list operations such as `Map` and `Filter` expressed in terms of `Fold` -* higher order list queries such as `Any`, `All` and `None` -* list generators such as `Iota` and `ListTabulate` +* higher order list queries such as `Find`, `Any`, `All` and `None` +* higher order list generators such as `ListTabulate` +* higher order list operations such as `TakeWhile`, `Partition` and `Sort` +* basic partial function application support using `Apply` * `static_assert` based test cases for all of the above +* MIT license ## Usage example @@ -29,15 +33,19 @@ Its MIT licensed source code is available on both [Github] and [cgit]. // 2 const std::size_t count = tav::Length< - tav::Filter< - tav::Odd, - tav::List<tav::Int<1>, tav::Int<2>, tav::Int<3>>::type - >::type ->::type::value; + tav::Filter< + tav::Odd, + tav::List<tav::Int<1>, tav::Int<2>, tav::Int<3>> + > +>::value; ~~~ {: .language-cpp} +Additionally there is a implementation of the _Sieve of Eratosthenes_ available as a more extensive [example]. + [ConstList]: /page/const_list/ [blog article]: /article/a_look_at_compile_time_computation_in_cpp/ [Github]: https://github.com/KnairdA/TypeAsValue/ [cgit]: http://code.kummerlaender.eu/TypeAsValue/ +[test cases]: https://github.com/KnairdA/TypeAsValue/blob/master/test.cc +[example]: https://github.com/KnairdA/TypeAsValue/blob/master/example/prime/prime.cc |