The algorithms are taken from the suggested implementations on cppreference. Hence, we assume them to be correct and we only make sure they compile, to avoid stupid mistakes I could have made when copy/pasting and editing. Oh, and we also make sure they can be used in a constexpr context.
| 15 | // |
| 16 | // Oh, and we also make sure they can be used in a constexpr context. |
| 17 | constexpr bool constexpr_context() { |
| 18 | int x = 0, y = 1; |
| 19 | hana::detail::constexpr_swap(x, y); |
| 20 | |
| 21 | int array[6] = {1, 2, 3, 4, 5, 6}; |
| 22 | int* first = array; |
| 23 | int* last = array + 6; |
| 24 | |
| 25 | hana::detail::reverse(first, last); |
| 26 | |
| 27 | hana::detail::next_permutation(first, last, hana::less); |
| 28 | hana::detail::next_permutation(first, last); |
| 29 | |
| 30 | hana::detail::lexicographical_compare(first, last, first, last, hana::less); |
| 31 | hana::detail::lexicographical_compare(first, last, first, last); |
| 32 | |
| 33 | hana::detail::equal(first, last, first, last, hana::equal); |
| 34 | hana::detail::equal(first, last, first, last); |
| 35 | |
| 36 | hana::detail::sort(first, last, hana::equal); |
| 37 | hana::detail::sort(first, last); |
| 38 | |
| 39 | hana::detail::find(first, last, 3); |
| 40 | hana::detail::find_if(first, last, hana::equal.to(3)); |
| 41 | |
| 42 | hana::detail::iota(first, last, 0); |
| 43 | |
| 44 | hana::detail::count(first, last, 2); |
| 45 | |
| 46 | hana::detail::accumulate(first, last, 0); |
| 47 | hana::detail::accumulate(first, last, 1, hana::mult); |
| 48 | |
| 49 | hana::detail::min_element(first, last); |
| 50 | |
| 51 | return true; |
| 52 | } |
| 53 | |
| 54 | static_assert(constexpr_context(), ""); |
| 55 |
no test coverage detected