Fitban

Visual c++ compiler

Visual c++ is a c++ compiler developed by microsoft, it is the foundation of c++ projects.

c++ class

c++ class is the basic building blocks of object-oriented programming. A class is an user-defined type, which can be used to create objects, similar to variables.

#include <iostream>

namespace hod
{
	class my_class
	{
	public:
		void print() const
		{
			std::cout << "Hello, c++!" << std::endl;
		}
	};
}

int main()
{
	hod::my_class object;
	object.print();
}

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

import std;

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