diff --git a/fit/always.h b/fit/always.h index 69cd77b..69950d3 100644 --- a/fit/always.h +++ b/fit/always.h @@ -23,10 +23,17 @@ /// -------- /// /// template -/// /* unspecified */ always(T value); +/// constexpr /* unspecified */ always(T value); /// /// template -/// /* unspecified */ always_ref(T value); +/// constexpr /* unspecified */ always_ref(T& value); +/// +/// Requirements +/// ------------ +/// +/// T must be: +/// +/// CopyConstructible /// /// Example /// ------- diff --git a/fit/compose.h b/fit/compose.h index 500fa5d..90ad877 100644 --- a/fit/compose.h +++ b/fit/compose.h @@ -23,8 +23,16 @@ /// Synopsis /// -------- /// -/// template -/// compose_adaptor compose(F1 f1, F2 f2, ...); +/// template +/// constexpr compose_adaptor compose(Fs... fs); +/// +/// Requirements +/// ------------ +/// +/// Fs must be: +/// +/// FunctionObject +/// MoveConstructible /// /// Example /// ------- diff --git a/fit/conditional.h b/fit/conditional.h index da4c5bb..9c9be8d 100644 --- a/fit/conditional.h +++ b/fit/conditional.h @@ -22,7 +22,24 @@ /// 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: +/// as well. +/// +/// Synopsis +/// -------- +/// +/// template +/// constexpr conditional_adaptor conditional(Fs... fs); +/// +/// Requirements +/// ------------ +/// +/// Fs must be: +/// +/// FunctionObject +/// MoveConstructible +/// +/// Example +/// ------- /// /// struct for_ints /// { @@ -49,13 +66,6 @@ /// /// 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, ...); -/// #include #include diff --git a/fit/fix.h b/fit/fix.h index 0f2becf..6c1fbd8 100644 --- a/fit/fix.h +++ b/fit/fix.h @@ -15,7 +15,11 @@ /// ----------- /// /// The `fix` function adaptor implements a fixed-point combinator. This can be -/// used to write recursive functions. +/// used to write recursive functions. +/// +/// Note: Compilers are too eager to instantiate templates when using +/// constexpr, which causes the compiler to reach its internal instantiation +/// limit. So, unfortunately, `fix` cannot be used for `constexpr functions. /// /// Synopsis /// -------- @@ -23,6 +27,14 @@ /// template /// fix_adaptor fix(F f); /// +/// Requirements +/// ------------ +/// +/// F must be: +/// +/// FunctionObject +/// MoveConstructible +/// /// Example /// ------- /// diff --git a/fit/fuse.h b/fit/fuse.h index 80f41c4..5c83a6d 100644 --- a/fit/fuse.h +++ b/fit/fuse.h @@ -23,6 +23,14 @@ /// template /// fuse_adaptor fuse(F f); /// +/// Requirements +/// ------------ +/// +/// F must be: +/// +/// FunctionObject +/// MoveConstructible +/// /// Example /// ------- /// diff --git a/fit/implicit.h b/fit/implicit.h index af0bb36..d93cc4b 100644 --- a/fit/implicit.h +++ b/fit/implicit.h @@ -27,6 +27,14 @@ /// template