PrevUpHomeNext

utx::print_tuples


utx::print_tuples is a very simple and convenient c++ template function to print all elements of std::tuple or many tuples.

template <utx::kspt::printable_tuple ... TTL>
inline void print_tuples(const TTL & ... tuples);

Include

#include <utxcpp/core.hpp>

Notice

[Note] Note
  • It separates each element by a space.
  • It separates each tuple by a newline character.
  • It prints a newline character at the end.
  • concept requirements:
    • Every tuple must satisfy utx::kspt::printable_tuple, otherwise the tuple can not be printed by utx::print_tuples. For example, a tuple contains utx::pest can not be printed by it.
    • Every element of every tuple must satisfy utx::kspt::printable.
    • Basic printable types satisfy utx::kspt::printable.
    • Non-basic types must implement operator<< to satisfy utx::kspt::printable.

Example

#include <utxcpp/core.hpp>
#include <tuple>

using namespace utx::string_literals;

int main()
{
	auto t1 = std::make_tuple(123, "utxcpp"_us, true, "c++"s, 3.4);
	auto t2 = std::make_tuple(12, 3, 4, "go", false);
	auto t3 = std::make_tuple('K', 2, 3, 4, 1);

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

Last revised: December 30, 2022 at 06:53:22 GMT


PrevUpHomeNext