Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/type_traits.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ template with no runtime arguments is called with the pack of arguments.
----
using L1 = stdx::type_list<std::integral_constant<int, 1>,
std::integral_constant<int, 2>>;
int x = stdx::apply_sequence<L1>([&] <typename... Ts> () { return (0 + ... + Ts::value); });
int x = stdx::apply_sequence<L1>([] <typename... Ts> () { return (0 + ... + Ts::value); });
// x is 3

using L2 = stdx::value_list<1, 2>;
int y = stdx::apply_sequence<L2>([&] <auto... Vs> () { return (0 + ... + Vs); });
int y = stdx::apply_sequence<L2>([] <auto... Vs> () { return (0 + ... + Vs); });
// y is 3
----

Expand All @@ -61,8 +61,8 @@ https://en.cppreference.com/w/cpp/utility/integer_sequence[`std::integer_sequenc
[source,cpp]
----
using L3 = stdx::make_index_sequence<3>;
auto y = stdx::apply_sequence<L3>([&] <auto... Vs> () { y += V; });
// y is 3
auto y = stdx::apply_sequence<L3>([] <auto... Vs> () { return (0 + ... + Vs); });
// y is 3 (a std::size_t)
----

NOTE: If the function iterates the pack by folding over `operator,` then
Expand Down
2 changes: 2 additions & 0 deletions test/type_traits.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ TEST_CASE("apply_sequence with value list", "[type_traits]") {
TEST_CASE("apply_sequence with index sequence", "[type_traits]") {
using L = std::make_index_sequence<3>;
CHECK(stdx::apply_sequence<L>(add_values{}) == 3);
STATIC_CHECK(std::is_same_v<decltype(stdx::apply_sequence<L>(add_values{})),
std::size_t>);
}

TEST_CASE("is_same_unqualified", "[type_traits]") {
Expand Down