diff --git a/Guidelines.md b/Guidelines.md index fab576b..824c28b 100644 --- a/Guidelines.md +++ b/Guidelines.md @@ -920,6 +920,18 @@ using c4 = cartesian_product_t, std::integer_se // c3 == std::tuple // c4 == std::integer_sequence +// descartes product +std::vector v1 { 1, 2, 3, 4 }; +std::vector v2 { 9.8f, 4.4f }; +std::vector v3 { "r", "g", "b" }; + +descartes_product([](int x, float y, const std::string& z) +{ + std::cout << x << " " << y << " " << z << std::endl; +}, v1, v2, v3); + +// print elements from v1 x v2 x v3 + // matrix operatings using matrix = std::tuple, std::tuple, diff --git a/README.md b/README.md index 063b2eb..900f079 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ ## Overview ```cpp #include + using namespace monster; int main(int argc, char* argv[]) diff --git a/Tutorial.md b/Tutorial.md index c62205f..72e5622 100644 --- a/Tutorial.md +++ b/Tutorial.md @@ -1564,12 +1564,20 @@ int main(int argc, char* argv[]) { [](float i){ std::cout << "float " << i << std::endl; }, [](double d){ std::cout << "double " << d << std::endl; }, - [](const auto& s){ std::cout << "string " << s << std::endl; } + [](const std::string& s){ std::cout << "string " << s << std::endl; } }; for (auto&& v : to_range(tup)) std::visit(show, v); + std::any a = 7; + + a = float(1.98); + any_visit(show, a); + + a = std::string("[]