TTS v3.0.0
The Tiny Test System
 
Loading...
Searching...
No Matches
Type Utilities

Classes

struct  tts::cartesian_product< L1, L2 >
 Generate the Cartesian product of two type lists. More...
 
struct  tts::filter< Pred, Type >
 Filter a types list by a predicate. More...
 
struct  tts::type< T >
 Encapsulates a single type into a reusable type object. More...
 
struct  tts::types< Ts >
 Encapsulates a variadic list of types into a reusable object. More...
 

Typedefs

using tts::arithmetic_types = types< double, float, std::int64_t, std::int32_t, std::int16_t, std::int8_t, std::uint64_t, std::uint32_t, std::uint16_t, std::uint8_t >
 Types list containing all standard arithmetic types.
 
using tts::int_types = types< std::int64_t, std::int32_t, std::int16_t, std::int8_t >
 Types list containing all standard signed integer types.
 
using tts::integral_types = types< std::int64_t, std::int32_t, std::int16_t, std::int8_t, std::uint64_t, std::uint32_t, std::uint16_t, std::uint8_t >
 Types list containing all standard integer types.
 
using tts::real_types = types< double, float >
 Types list containing all standard floating point types.
 
using tts::signed_types = types< double, float, std::int64_t, std::int32_t, std::int16_t, std::int8_t >
 Types list containing all standard signed types.
 
using tts::uint_types = types< std::uint64_t, std::uint32_t, std::uint16_t, std::uint8_t >
 Types list containing all standard unsigned types.
 

Functions

template<typename T >
constexpr auto tts::name (T const &t)
 Returns the name of the type T in readable form.
 

Variables

template<typename T >
auto constexpr tts::typename_ = _::typename_impl<T> {}
 Evaluates to an object containing the name of the type T in readable form.
 

Function Documentation

◆ name()

template<typename T >
constexpr auto tts::name ( T const &  t)
constexpr

#include <tts/tools/typename.hpp>

Returns the name of the type T in readable form.

This function is a convenience wrapper around typename_.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE_WITH("Check name() utility", (int, float, std::vector<double>), tts::value {37})
(auto const& args) { TTS_PASS("tts::name(args) = '" + tts::as_text(tts::name(args)) + "'"); };
#define TTS_PASS(...)
Force a passing test and display a message.
Definition info.hpp:44
#define TTS_CASE_WITH(ID, TYPES,...)
Introduces a template test case providing dynamically generated data to the test code.
Definition case.hpp:201
text as_text(T const &e)
Value-to-string conversion.
Definition as_text.hpp:49
constexpr auto name(T const &t)
Returns the name of the type T in readable form.
Definition typename.hpp:142
Defines a data generator that always return the same value.
Definition generator.hpp:137
Parameters
tValue to retrieve the type name for.
Returns
A typename_ instance representing the name of T as a string-like object.

Variable Documentation

◆ typename_

template<typename T >
auto constexpr tts::typename_ = _::typename_impl<T> {}
inlineconstexpr

#include <tts/tools/typename.hpp>

Evaluates to an object containing the name of the type T in readable form.

typename_<T> is a constexpr object that can be used to retrieve the name of a type T as a text-like object. It can be used in conjunction with as_text or stream output operators to display type names.

Example

#define TTS_MAIN // No need for main()
#include <tts/tts.hpp>
#include <vector>
TTS_CASE_TPL("Check typename_ utility", int, float, std::vector<double>)<typename T>(tts::type<T>)
{
TTS_PASS("Type name: '" + tts::as_text(tts::typename_<T>) + "'");
};
#define TTS_CASE_TPL(ID,...)
Introduces a template test case and registers it into the current test driver.
Definition case.hpp:170
auto constexpr typename_
Evaluates to an object containing the name of the type T in readable form.
Definition typename.hpp:126
Encapsulates a single type into a reusable type object.
Definition types.hpp:112
Template Parameters
TType to query.