diff --git a/doc/gendoc b/doc/gendoc index b568d6c..4e74fb7 100755 --- a/doc/gendoc +++ b/doc/gendoc @@ -2,36 +2,28 @@ function extract { - sed -n '/^\/\/\/ /s,/// ,,p' $1 + sed -n '/^\/\/\/ /s,/// ,,p' ../fit/$1.h > src/$1.md } -echo "" > src/adaptors.md - -extract ../fit/compose.h >> src/adaptors.md -extract ../fit/conditional.h >> src/adaptors.md -extract ../fit/fix.h >> src/adaptors.md -extract ../fit/fuse.h >> src/adaptors.md -extract ../fit/implicit.h >> src/adaptors.md -extract ../fit/invoke.h >> src/adaptors.md -extract ../fit/lazy.h >> src/adaptors.md -extract ../fit/match.h >> src/adaptors.md -extract ../fit/mutable.h >> src/adaptors.md -extract ../fit/on.h >> src/adaptors.md -extract ../fit/partial.h >> src/adaptors.md -extract ../fit/pipable.h >> src/adaptors.md -extract ../fit/placeholders.h >> src/adaptors.md -extract ../fit/protect.h >> src/adaptors.md -extract ../fit/reveal.h >> src/adaptors.md -extract ../fit/static.h >> src/adaptors.md -extract ../fit/variadic.h >> src/adaptors.md - -echo "" > src/functions.md - -extract ../fit/always.h >> src/functions.md -extract ../fit/identity.h >> src/functions.md - -echo "" > src/utilities.md - -extract ../fit/args.h >> src/utilities.md -extract ../fit/is_callable.h >> src/utilities.md -extract ../fit/returns.h >> src/utilities.md +extract always +extract args +extract compose +extract conditional +extract fix +extract fuse +extract identity +extract implicit +extract invoke +extract is_callable +extract lazy +extract match +extract mutable +extract on +extract partial +extract pipable +extract placeholders +extract protect +extract returns +extract reveal +extract static +extract variadic diff --git a/doc/src/adaptors.md b/doc/src/adaptors.md deleted file mode 100644 index 6ea1d45..0000000 --- a/doc/src/adaptors.md +++ /dev/null @@ -1,464 +0,0 @@ - -compose -====== - -Description ------------ - -The `compose` function adaptor provides funcion composition. It produces a -function object that composes a set of functions, ie the output of one -function becomes the input of the second function. So, `compose(f, g)(0)` is -equivalent to `f(g(0))`. - - -Synopsis --------- - - template - compose_adaptor compose(F1 f1, F2 f2, ...); - -Example -------- - - struct increment - { - template - T operator()(T x) const - { - return x + 1; - } - }; - - struct decrement - { - template - T operator()(T x) const - { - return x - 1; - } - }; - - int r = compose(increment(), decrement(), increment())(3); - assert(r == 4); - -conditional -=========== - -Description ------------ - -The `conditional` function adaptor combines several functions together. If the -first function can not be called, then it will try to call the next function. - -Note: This is different than the `match` function adaptor, which can lead -to ambiguities. Instead, `conditional` will call the first function that -is callable, regardless if there is another function that could be called -as well. So, for example: - - struct for_ints - { - void operator()(int) const - { - printf("Int\n"); - } - }; - - struct for_floats - { - void operator()(int) const - { - printf("Float\n"); - } - }; - - conditional(for_ints(), for_floats())(3.0); - -This will print `Int` because the `for_floats` function object won't ever be -called. Due to the conversion rules in C++, the `for_ints` function can be -called on floats, so it is chosen by `conditional` first, even though -`for_floats` is a better match. - -So, the order of the functions in the `conditional_adaptor` are very important -to how the function is chosen. - -Synopsis --------- - - template - conditional_adaptor conditional(F1 f1, F2 f2, ...); - -fix -=== - -Description ------------ - -The `fix` function adaptor implements a fixed-point combinator. This can be -used to write recursive functions. - -Synopsis --------- - - template - fix_adaptor fix(F f); - -Example -------- - - int r = fit::fix([](auto s, auto x) -> decltype(x) { return x == 0 ? 1 : x * s(x-1); })(5); - assert(r, 5*4*3*2*1); - -fuse -==== - -Description ------------ - -The `fuse` function adaptor takes a tuple and uses that for the arguments -to the function. - -Synopsis --------- - - template - fuse_adaptor fuse(F f); - -Example -------- - - struct sum - { - template - T sum(T x, T y) - { - return x+y; - } - }; - - int r = fuse(sum())(std::make_tuple(3,2)); - assert(r, 5); - -implicit -======== - -Description ------------ - -The `implicit` adaptor is a static function adaptor that uses the type that -return value can be converted to in order to determine the type of the -template parameter. Since it is static function adaptor, the function must be -default constructible. - -Synopsis --------- - - template