25using namespace ugmisc;
45 static const char * const sTypeName; \
47 const char * const name::sTypeName = #name
62 static std::string sTypeName() {
63 return std::string(
"Pluralise<") + getTypeName<T>() +
">";
71struct Pluralise<Lion> :
public PluraliseBase<Lion> {
76struct Pluralise<Siamese> :
public PluraliseBase<Siamese> {
77 using type = Siameeses;
81struct Pluralise<Car> :
public PluraliseBase<Car> {
86struct Pluralise<Van> :
public PluraliseBase<Van> {
95using CatsVariant = Cats::apply_t<std::variant>;
96using VehiclesTuple = Vehicles::apply_t<std::tuple>;
103struct is_cat :
public std::false_type {};
106struct is_cat<Lion> :
public std::true_type {};
109struct is_cat<Siamese> :
public std::true_type {};
125template<
class T,
class...Extras>
126static void print(
const char *name, Extras...extras) {
133 out.always() << name <<
":\n";
135 [[maybe_unused]]
auto& _out = (out << ... << extras);
138#define PRINT_LAST(...) print<__VA_ARGS__>(#__VA_ARGS__)
139#define PRINT(...) print<__VA_ARGS__>(#__VA_ARGS__, "\n")
141int main(
int,
char**) {
146 expect <<
"type_list\n" " Lion Siamese\n"
150 expect <<
"type_list\n" " Car Van\n"
154 expect <<
"type_list\n" " Lion Siamese Car Van\n"
158 expect <<
"variant\n" " Lion Siamese\n"
161 PRINT(VehiclesTuple);
162 expect <<
"tuple\n" " Car Van\n"
166 expect <<
"type_list\n" " Lion Siamese\n"
170 expect <<
"type_list\n" " Car Van\n"
173 PRINT(CatsFromVarious);
174 expect <<
"type_list\n" " Lion Siamese\n"
178 expect <<
"type_list\n" " Lions Siameeses Cars Vans\n"
182 expect <<
"type_list\n"
183 " Pluralise<Lion> Pluralise<Siamese> Pluralise<Car> Pluralise<Van>\n"
187 expect <<
"type_list\n"
188 " Van Car Siamese Lion\n"
191 PRINT(All::stride_t<0, 2, 2>);
192 expect <<
"type_list\n"
196 always <<
"\nResults of using the type_list methods and operators:\n\n";
201 PRINT(
decltype(lion.
append(siamese)) );
202 expect <<
"type_list\n"
206 PRINT(
decltype(lion + siamese) );
207 expect <<
"type_list\n"
213 std::integer_sequence<int, 0, 2, 2> stride_args;
216 std::integral_constant<int, 0> base;
217 std::integral_constant<int, 2> stride;
218 std::integral_constant<int, 2> count;
222 PRINT(
decltype(all.stride(stride_args)) );
223 expect <<
"type_list\n"
227 PRINT_LAST(
decltype(all.stride(base, stride, count)) );
228 expect <<
"type_list\n"
Encapsulates a list of types.
static constexpr append_t< U... > append(type_list< U... >)
Lists of types which may be used in some of the ugmisc templates where a single type would usually be...
typename typelist_::type_list_stride< Base, Stride, Count, T >::type type_list_stride
typename typelist_::apply_each< F, T >::class_types type_list_apply_each_class
type_list_filter< Test, flatten_t< T... >, Mod > flatten_filter
typename typelist_::filter_type_list< Test, T, Mod >::type type_list_filter
@ no_invert_test
Keep types when the Filter returns true.
typename typelist_::apply_each< F, T >::inner_types type_list_apply_each
typename concatenate_type_lists< T... >::type concatenate_type_lists_t