Skip to content

Commit

Permalink
improve documentation of metal::sort
Browse files Browse the repository at this point in the history
  • Loading branch information
ecrypa committed Oct 20, 2019
1 parent 6f6552c commit 06680ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion example/src/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ IS_SAME(
);

IS_SAME(
metal::sort<metal::numbers<7, -8, -3, 2>>, // use default ordering relation
metal::sort<metal::numbers<7, -8, -3, 2>>, // use default ordering
metal::sort<metal::numbers<7, -8, -3, 2>, metal::lambda<metal::less>>
);
/// [sort]
Expand Down
12 changes: 10 additions & 2 deletions include/metal/list/sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace metal {
/// using result = metal::sort<l, lbd>;
/// \endcode
///
/// \tip{`lbd` may be omitted, in which case it defaults to `metal::lambda<metal::less>`.}
///
/// \pre: For any two \values `val_i` and `val_j` contained in `l`
/// `metal::invoke<lbd, val_i, val_j>` returns a \number
/// \returns: \list
Expand All @@ -45,15 +43,25 @@ namespace metal {
/// such that `metal::invoke<lbd, val_i, val_i+1>{} != false` for all
/// `i` in `[0, m-2]`.
///
/// \tip{`lbd` may be omitted, in which case it defaults to `metal::lambda<metal::less>`.}
///
/// ### Example
/// \snippet list.cpp sort
///
/// ### See Also
/// \see list, reverse, rotate
#if !defined(METAL_WORKAROUND)
template<class seq, class lbd = metal::lambda<metal::less>>
using sort = detail::call<
detail::_sort<lbd>::template type,
metal::if_<metal::is_list<seq>, seq>>;
#else
// MSVC 14 has shabby SFINAE support in case of default alias template args
template<class seq, class... lbd>
using sort = detail::call<
detail::_sort<lbd...>::template type,
metal::if_<metal::is_list<seq>, seq>>;
#endif
}

#include "../lambda/lambda.hpp"
Expand Down

0 comments on commit 06680ac

Please # to comment.