Skip to content

[cpp, c++] utx::print_tuples: print many tuples (std::tuple)

utx::print_tuples

If you want to print all elements of std::tuple, or you want to print all elements of all tuples, utx::print_tuples will serve for you.

How to use utx::print_tuples: just pass all tuples you want to print to utx::print_tuples.

utx::print_tuples(tuple1, tuple2, tuple3, ...);

Utxcpp Project: https://cppfx.xyz/fossil/utxcpp

utx::print_tuples doc: https://cppfx.xyz/fx/static/docs/utxcpp/html/utx_print_tuples.html

An example

#include <utxcpp/core.hpp>
#include <tuple>
#include <complex>
                                                                                  
using namespace utx::string_literals;                                             
using namespace std::complex_literals;
                                                                                  
int main()
{
        auto t1 = std::make_tuple(123, true, "utxcpp"_us);
        const auto t2 = std::make_tuple(1, 2, 3, 1.2+2.3i);
        constexpr auto t3 = std::make_tuple(123i, 1.2+3.0i, false);

        utx::print_tuples(t1, t2, t3);
        utx::print();

        utx::print_tuples(std::move(t1), std::move(t2),
                std::move(t3), std::make_tuple("utxcpp"s));
        utx::print();

        utx::print_tuples(t1);
}

Output:

123 true utxcpp
1 2 3 (1.200000,2.300000)
(0.000000,123.000000) (1.200000,3.000000) false

123 true utxcpp
1 2 3 (1.200000,2.300000)                                                         
(0.000000,123.000000) (1.200000,3.000000) false
utxcpp

123 true utxcpp

 

 

 

Trackbacks

No Trackbacks

Comments

Display comments as Linear | Threaded

No comments

Add Comment

E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA

Form options

Submitted comments will be subject to moderation before being displayed.

@cppfx.xyz