コード例 #1
0
ファイル: p2.cpp プロジェクト: mbaroody/Recursion_cpp
static list_t append_helper(list_t first, list_t appended) {
    if (list_isEmpty(first)) return appended;
    return append_helper(list_rest(first), 
        list_make(list_first(first), appended));
}
コード例 #2
0
ファイル: p2.cpp プロジェクト: mbaroody/Recursion_cpp
list_t append(list_t first, list_t second) {
    return append_helper(reverse(first), second);
}
コード例 #3
0
ファイル: append.hpp プロジェクト: BeiLuoShiMen/hana
 static constexpr auto apply(Xs&& xs, X&& x) {
     constexpr std::size_t N = decltype(hana::length(xs))::value;
     return append_helper(static_cast<Xs&&>(xs), static_cast<X&&>(x),
                          std::make_index_sequence<N> {});
 }