Fitban

Gcc compiler

Gcc is a c++ compiler for the c++ programming language.

g++ 16.0.0 20250422 (gcc)

gpp --version

gpp (GCC) 16.0.0 20250422 (experimental)
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

g++ 16.0 and c++26 pack indexing

#include <iostream>

template <typename ... type_list>
class my_basic_class
{
};

template <auto ... value_list>
class my_class
{
public:
	template <int ... index_list>
	constexpr static auto tuple()
	{
		return std::tuple{value_list ... [index_list] ...};
	}
};

template <typename ... type_list>
class my_class_2
{
};

int main()
{
	using type = my_class<3.2, 25, true, 2.3f, 11u>;

	constexpr auto x1 = type::tuple<0, 2, 2, 0, 3>();
	constexpr auto x2 = type::tuple<4, 3, 2, 1>();

	static_assert(x1 == std::tuple<double, bool, bool, double, float>{3.2, true, true, 3.2, 2.3f});
	static_assert(x2 == std::tuple<unsigned, float, bool, int>{11u, 2.3f, true, 25});
}


•••
•••••

A c++ World


Github

Fitban