Skip to content

[cpp, c++] utx::kspt::printable_tuple, utx::kspt::tuple, utx::kspt::printale (utxcpp)

utx::kspt::printable_tuple

A c++ concept in utxcpp library. The type of every element of the tuple must satisfy utx::printable.

utx::kspt::tuple

A c++ concept in utxcpp library. The type must be std::tuple type.

utx::kspt::printable

A c++ concept in utxcpp library. For example, std::string and utx::string satisfy utx::kspt::printable, but utx::Pest does not satisfy utx::kspt::printable.

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

Example

T1 satisfy utx::kspt::printable_tuple, and utx::kspt::tuple, but does not satisfy utx::kspt::printable. Satisfying utx::kspt::printable_tuple does not mean satisfying utx::kspt::printable.

T2 does not satisfy utx::kspt::printable_tuple, but satisfy utx::kspt::tuple, because utx::Pest does not satisfy utx::kspt::printable.

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

using namespace utx::string_literals;
using namespace std::complex_literals;

template <utx::kspt::printable_tuple T>
class fizz {};

template <utx::kspt::tuple T>
class buzz {};

template <utx::kspt::printable T>
class but {};

template <typename T>
class fit {};

int main()
{
        using T1 = std::tuple<float, int, utx::string>;
        using T2 = std::tuple<float, std::string, utx::Pest>;
        using T3 = float;
        using T4 = utx::Pest;

        fizz<T1>{};
        buzz<T1>{};
        // but<T1>{}; // T1 does not satisfy utx::kspt::printable

        // fizz<T2>{}; // T2 does not satisfy utx::kspt::printbale_tuple
        buzz<T2>{};

        // fizz<T3>{};
        // buzz<T3>{};
        but<T3>{};

        //but<T4>{};
        fit<T4>{};
}

 

 

 

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