/ranges/view_interface/front "cpp/ranges/view interface/front") (C++20)  |  returns the first element in the derived view. Provided if it satisfies [ ` forward_range ` ](/w/cpp/ranges/forward_range "cpp/ranges/forward range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_front&action=edit)  
[ back  ](/w/cpp/ranges/view_interface/back "cpp/ranges/view interface/back") (C++20)  |  returns the last element in the derived view. Provided if it satisfies [ ` bidirectional_range ` ](/w/cpp/ranges/bidirectional_range "cpp/ranges/bidirectional range") and [ ` common_range ` ](/w/cpp/ranges/common_range "cpp/ranges/common range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_back&action=edit)  
[ operator[]  ](/w/cpp/ranges/view_interface/operator_at "cpp/ranges/view interface/operator at") (C++20)  |  returns the n  th  element in the derived view. Provided if it satisfies [ ` random_access_range ` ](/w/cpp/ranges/random_access_range "cpp/ranges/random access range") .   
(public member function of ` std::ranges::view_interface<D> ` )  [ [edit]
](https://en.cppreference.com/mwiki/index.php?title=Template:cpp/ranges/view_interface/dsc_operator_at&action=edit)  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/cartesian_product_view&action=edit&section=3
"Edit section: Deduction guides") ]  [ Deduction guides
](/w/cpp/ranges/cartesian_product_view/deduction_guides "cpp/ranges/cartesian
product view/deduction guides")

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/cartesian_product_view&action=edit&section=4
"Edit section: Nested classes") ]  Nested classes

[ _ iterator  _ ](/w/cpp/ranges/cartesian_product_view/iterator "cpp/ranges/cartesian product view/iterator") (C++23)  |  the iterator type   
(  exposition-only member class template*  )  
---|---  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/cartesian_product_view&action=edit&section=5
"Edit section: Notes") ]  Notes

[ Feature-test ](/w/cpp/utility/feature_test "cpp/utility/feature test") macro  |  Value  |  Std  |  Feature   
---|---|---|---  
[ ` __cpp_lib_ranges_cartesian_product ` ](/w/cpp/feature_test#cpp_lib_ranges_cartesian_product "cpp/feature test") |  202207L  |  (C++23)  |  ` std::ranges::cartesian_product_view `  
  
###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/cartesian_product_view&action=edit&section=6
"Edit section: Example") ]  Example

Run this code

    
    
    #include <array>
    #include <iostream>
    #include <list>
    #include <ranges>
    #include <string>
    #include <vector>
     
    void print([std::tuple](http://en.cppreference.com/w/cpp/utility/tuple)<char const&, int const&, [std::string](http://en.cppreference.com/w/cpp/string/basic_string) const&> t, int pos)
    {
        const auto& [a, b, c] = t;
        [std::cout](http://en.cppreference.com/w/cpp/io/cout) << '(' << a << ' ' << b << ' ' << c << ')' << (pos % 4 ? " " : "\n");
    }
     
    int main()
    {
        const auto x = [std::array](http://en.cppreference.com/w/cpp/container/array){'A', 'B'};
        const auto y = [std::vector](http://en.cppreference.com/w/cpp/container/vector){1, 2, 3};
        const auto z = [std::list](http://en.cppreference.com/w/cpp/container/list)<[std::string](http://en.cppreference.com/w/cpp/string/basic_string)>{"α", "β", "γ", "δ"};
     
        for (int i{1}; auto const& tuple : std::views::cartesian_product(x, y, z))
            print(tuple, i++);
    }

Output:

    
    
    (A 1 α) (A 1 β) (A 1 γ) (A 1 δ)
    (A 2 α) (A 2 β) (A 2 γ) (A 2 δ)
    (A 3 α) (A 3 β) (A 3 γ) (A 3 δ)
    (B 1 α) (B 1 β) (B 1 γ) (B 1 δ)
    (B 2 α) (B 2 β) (B 2 γ) (B 2 δ)
    (B 3 α) (B 3 β) (B 3 γ) (B 3 δ)

###  [ [ edit
](/mwiki/index.php?title=cpp/ranges/cartesian_product_view&action=edit&section=7
"Edit